Commit bec9c64e authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging



* CAN bus (will be under network maintainner)
* scsi-block opblockers (myself)
* Dirty log bitmap cleanup (myself)
* SDHCI improvements and tests (Philippe)
* HAX support for larger guest sizese (Yu Ning)

# gpg: Signature made Tue 13 Feb 2018 15:37:14 GMT
# gpg:                using RSA key BFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream: (48 commits)
  travis: use libgcc-4.8-dev (libgcc-6-dev is not available on Ubuntu 14.04)
  memory: unify loops to sync dirty log bitmap
  memory: hide memory_region_sync_dirty_bitmap behind DirtyBitmapSnapshot
  memory: remove memory_region_test_and_clear_dirty
  g364fb: switch to using DirtyBitmapSnapshot
  sdhci: add Spec v4.2 register definitions
  sdhci: add a check_capab_v3() qtest
  sdhci: check Spec v3 capabilities qtest
  hw/arm/xilinx_zynqmp: enable the UHS-I mode
  hw/arm/xilinx_zynqmp: fix the capabilities/spec version to match the datasheet
  hw/arm/fsl-imx6: implement SDHCI Spec. v3
  hw/arm/bcm2835_peripherals: change maximum block size to 1kB
  hw/arm/bcm2835_peripherals: implement SDHCI Spec v3
  sdhci: implement CMD/DAT[] fields in the Present State register
  sdhci: implement UHS-I voltage switch
  sdbus: add trace events
  sdhci: implement the Host Control 2 register (tuning sequence)
  sdhci: rename the hostctl1 register
  sdhci: add support for v3 capabilities
  hw/arm/xilinx_zynq: fix the capabilities register to match the datasheet
  ...

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents b734ed9d 7524a39d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@ addons:
      - libattr1-dev
      - libbrlapi-dev
      - libcap-ng-dev
      - libgcc-6-dev
      - libgcc-4.8-dev
      - libgnutls-dev
      - libgtk-3-dev
      - libiscsi-dev
+3 −2
Original line number Diff line number Diff line
@@ -294,7 +294,7 @@ else
DOCS=
endif

SUBDIR_MAKEFLAGS=BUILD_DIR=$(BUILD_DIR)
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory --quiet) BUILD_DIR=$(BUILD_DIR)
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))

@@ -958,4 +958,5 @@ ifdef QEMU_GA_MSI_ENABLED
endif
	@echo  ''
endif
	@echo  '  $(MAKE) V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
	@echo  '  $(MAKE) [targets]      (quiet build, default)'
	@echo  '  $(MAKE) V=1 [targets]  (verbose build)'
+9 −7
Original line number Diff line number Diff line
@@ -471,10 +471,8 @@ for opt do
  --cpu=*) cpu="$optarg"
  ;;
  --extra-cflags=*) QEMU_CFLAGS="$QEMU_CFLAGS $optarg"
                    EXTRA_CFLAGS="$optarg"
  ;;
  --extra-cxxflags=*) QEMU_CXXFLAGS="$QEMU_CXXFLAGS $optarg"
                      EXTRA_CXXFLAGS="$optarg"
  ;;
  --extra-ldflags=*) LDFLAGS="$LDFLAGS $optarg"
                     EXTRA_LDFLAGS="$optarg"
@@ -1424,7 +1422,6 @@ case "$cpu" in
esac

QEMU_CFLAGS="$CPU_CFLAGS $QEMU_CFLAGS"
EXTRA_CFLAGS="$CPU_CFLAGS $EXTRA_CFLAGS"

# For user-mode emulation the host arch has to be one we explicitly
# support, even if we're using TCI.
@@ -5309,7 +5306,15 @@ fi
##########################################
# checks for sanitizers

write_c_skeleton
# we could use a simple skeleton for flags checks, but this also
# detect the static linking issue of ubsan, see also:
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84285
cat > $TMPC << EOF
#include <stdint.h>
int main(void) {
  return INT32_MIN / -1;
}
EOF

have_asan=no
have_ubsan=no
@@ -5877,9 +5882,6 @@ if test "$mingw32" = "no" ; then
  echo "qemu_localstatedir=$local_statedir" >> $config_host_mak
fi
echo "qemu_helperdir=$libexecdir" >> $config_host_mak
echo "extra_cflags=$EXTRA_CFLAGS" >> $config_host_mak
echo "extra_cxxflags=$EXTRA_CXXFLAGS" >> $config_host_mak
echo "extra_ldflags=$EXTRA_LDFLAGS" >> $config_host_mak
echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
echo "libs_softmmu=$libs_softmmu" >> $config_host_mak
echo "GIT=$git" >> $config_host_mak
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ CONFIG_ESP_PCI=y
CONFIG_SERIAL=y
CONFIG_SERIAL_ISA=y
CONFIG_SERIAL_PCI=y
CONFIG_CAN_BUS=y
CONFIG_CAN_SJA1000=y
CONFIG_CAN_PCI=y
CONFIG_IPACK=y
CONFIG_WDT_IB6300ESB=y
CONFIG_PCI_TESTDEV=y

docs/can.txt

0 → 100644
+107 −0
Original line number Diff line number Diff line
QEMU CAN bus emulation support
==============================

The CAN bus emulation provides mechanism to connect multiple
emulated CAN controller chips together by one or multiple CAN busses
(the controller device "canbus"  parameter). The individual busses
can be connected to host system CAN API (at this time only Linux
SocketCAN is supported).

The concept of busses is generic and different CAN controllers
can be implemented for it but at this time only SJA1000 chip
controller is implemented.

The PCI addon card hardware has been selected as the first CAN
interface to implement because such device can be easily connected
to systems with different CPU architectures (x86, PowerPC, ARM, etc.).

The project has been initially started in frame of RTEMS GSoC 2013
slot by Jin Yang under our mentoring  The initial idea was to provide generic
CAN subsystem for RTEMS. But lack of common environment for code and RTEMS
testing lead to goal change to provide environment which provides complete
emulated environment for testing and RTEMS GSoC slot has been donated
to work on CAN hardware emulation on QEMU.

Examples how to use CAN emulation
=================================

When QEMU with CAN PCI support is compiled then one of the next
CAN boards can be selected

 (1) CAN bus Kvaser PCI CAN-S (single SJA1000 channel) boad. QEMU startup options
    -object can-bus,id=canbus0
    -device kvaser_pci,canbus=canbus0
    Add "can-host-socketcan" object to connect device to host system CAN bus
    -object can-host-socketcan,id=canhost0,if=can0,canbus=canbus0

 (2) CAN bus PCM-3680I PCI (dual SJA1000 channel) emulation
    -object can-bus,id=canbus0
    -device pcm3680_pci,canbus0=canbus0,canbus1=canbus0

 another example:
    -object can-bus,id=canbus0
    -object can-bus,id=canbus1
    -device pcm3680_pci,canbus0=canbus0,canbus1=canbus1

 (3) CAN bus MIOe-3680 PCI (dual SJA1000 channel) emulation
    -device mioe3680_pci,canbus0=canbus0


The ''kvaser_pci'' board/device model is compatible with and has been tested with
''kvaser_pci'' driver included in mainline Linux kernel.
The tested setup was Linux 4.9 kernel on the host and guest side.
Example for qemu-system-x86_64:

    qemu-system-x86_64 -enable-kvm -kernel /boot/vmlinuz-4.9.0-4-amd64 \
      -initrd ramdisk.cpio \
      -virtfs local,path=shareddir,security_model=none,mount_tag=shareddir \
      -object can-bus,id=canbus0 \
      -object can-host-socketcan,id=canhost0,if=can0,canbus=canbus0 \
      -device kvaser_pci,canbus=canbus0 \
      -nographic -append "console=ttyS0"

Example for qemu-system-arm:

    qemu-system-arm -cpu arm1176 -m 256 -M versatilepb \
      -kernel kernel-qemu-arm1176-versatilepb \
      -hda rpi-wheezy-overlay \
      -append "console=ttyAMA0 root=/dev/sda2 ro init=/sbin/init-overlay" \
      -nographic \
      -virtfs local,path=shareddir,security_model=none,mount_tag=shareddir \
      -object can-bus,id=canbus0 \
      -object can-host-socketcan,id=canhost0,if=can0,canbus=canbus0 \
      -device kvaser_pci,canbus=canbus0,host=can0 \

The CAN interface of the host system has to be configured for proper
bitrate and set up. Configuration is not propagated from emulated
devices through bus to the physical host device. Example configuration
for 1 Mbit/s

  ip link set can0 type can bitrate 1000000
  ip link set can0 up

Virtual (host local only) can interface can be used on the host
side instead of physical interface

  ip link add dev can0 type vcan

The CAN interface on the host side can be used to analyze CAN
traffic with "candump" command which is included in "can-utils".

  candump can0

Links to other resources
========================

 (1) Repository with development branch can-pci at Czech Technical University
     https://gitlab.fel.cvut.cz/canbus/qemu-canbus
 (2) GitHub repository with can-pci and our other changes included
     https://gitlab.fel.cvut.cz/canbus/qemu-canbus
 (3) RTEMS page describing project
     https://devel.rtems.org/wiki/Developer/Simulators/QEMU/CANEmulation
 (4) RTLWS 2015 article about the projevt and its use with CANopen emulation
     http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can.pdf
     Slides
     http://rtime.felk.cvut.cz/publications/public/rtlws2015-qemu-can-slides.pdf
 (5) Linux SocketCAN utilities
     https://github.com/linux-can/can-utils/
 No newline at end of file
Loading