1. 04 4月, 2011 16 次提交
  2. 02 4月, 2011 23 次提交
    • A
      ccid: add ccid-card-emulated device · 585738a6
      Alon Levy 提交于
      This devices uses libcacard (internal) to emulate a smartcard conforming
      to the CAC standard. It attaches to the usb-ccid bus. Usage instructions
      (example command lines) are in the following patch in docs/ccid.txt. It
      uses libcacard which uses nss, so it can work with both hw cards and
      certificates (files).
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      changes from v20->v21: (Jes Sorenson review)
       * cosmetics
       * use qemu-thread and qemu_malloc/qemu_free
      
      changes from v19->v20:
       * checkpatch.pl
      
      changes from v18->v19:
       * add qdev.desc
       * backend: drop the enumeration property, back to using a string one.
      
      changes from v16->v17:
       * use PROP_TYPE_ENUM for backend
      
      changes from v15->v16:
       * fix error reporting in initfn
       * bump copyright year
       * update copyright license
      
      changes from v1:
       * remove stale comments, use only c-style comments
       * bugfix, forgot to set recv_len
       * change reader name to 'Virtual Reader'
      585738a6
    • A
      ccid: add passthru card device · edbb2136
      Alon Levy 提交于
      The passthru ccid card is a device sitting on the usb-ccid bus and
      using a chardevice to communicate with a remote device using the
      VSCard protocol defined in libcacard/vscard_common.h
      
      Usage docs available in following patch in docs/ccid.txt
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      Changes from v23->v24:
       * fixed double license line in header.
      
      Changes from v20->v21: (Jes Sorensen review)
       * add reference to COPYING in header
       * long comment reformatting
      
      Changes from v19->v20:
       * checkpatch.pl
      
      Changes from v18->v19:
       * add qdev.desc
       * remove .qdev.unplug (no hot unplug support for ccid bus)
      
      Changes from v16->v17:
       * fix wrong cast when receiving VSC_Error
       * ccid-card-passthru: force chardev user wakeup by sending Init
         see lengthy comment below.
      
      Changes from v15->v16:
      
      Behavioral changes:
       * return correct size
       * return error instead of assert if client sent too large ATR
       * don't assert if client sent too large a size, but add asserts for indices to buffer
       * reset vscard_in indices on chardev disconnect
       * handle init from client
       * error if no chardev supplied
       * use ntoh, hton
       * eradicate reader_id_t
       * remove Reconnect usage (removed from VSCARD protocol)
       * send VSC_SUCCESS on card insert/remove and reader add/remove
      
      Style fixes:
       * width of line fix
       * update copyright
       * remove old TODO's
       * update file header comment
       * use macros for debug levels
       * c++ style comment replacement
       * update copyright license
       * fix ATR size comment
       * fix whitespace in struct def
       * fix DPRINTF prefix
       * line width fix
      
      ccid-card-passthru: force chardev user wakeup by sending Init
      
      The problem: how to wakeup the user of the smartcard when the smartcard
      device is initialized?
      
      Long term solution: have a callback interface. This was done via
      the deprecated so called chardev ioctl interface.
      
      Short term solution: do a write. Specifically we write an Init message.
      And we change the client to send it's own Init message regardless of
      receiving this one. Additional Init messages will be regarded as
      acceptable, the first one received after connection establishment is
      the determining one wrt capabilities.
      edbb2136
    • A
      usb-ccid: add CCID bus · 36707144
      Alon Levy 提交于
      A CCID device is a smart card reader. It is a USB device, defined at [1].
      This patch introduces the usb-ccid device that is a ccid bus. Next patches will
      introduce two card types to use it, a passthru card and an emulated card.
      
       [1] http://www.usb.org/developers/devclass_docs/DWG_Smart-Card_CCID_Rev110.
      Signed-off-by: NAlon Levy <alevy@redhat.com>
      
      ---
      
      changes from v20->v21: (Jes Sorenson review)
       * cosmetic changes - fix multi line comments.
       * reorder fields in USBCCIDState
       * add reference to COPYING
       * add --enable-smartcard and --disable-smartcard here (moved
       from last patch)
      
      changes from v19->v20:
       * checkpatch.pl
      
      changes from v18->v19:
       * merged: ccid.h: add copyright, fix define and remove non C89 comments
       * add qdev.desc
      
      changes from v15->v16:
      
      Behavioral changes:
       * fix abort on client answer after card remove
       * enable migration
       * remove side affect code from asserts
       * return consistent self-powered state
       * mask out reserved bits in ccid_set_parameters
       * add missing abRFU in SetParameters (no affect on linux guest)
      
      whitefixes / comments / consts defines:
       * remove stale comment
       * remove ccid_print_pending_answers if no DEBUG_CCID
       * replace printf's with DPRINTF, remove DEBUG_CCID, add verbosity defines
       * use error_report
       * update copyright (most of the code is not original)
       * reword known bug comment
       * add missing closing quote in comment
       * add missing whitespace on one line
       * s/CCID_SetParameter/CCID_SetParameters/
       * add comments
       * use define for max packet size
      
      Comment for "return consistent self-powered state":
      
      the Configuration Descriptor bmAttributes claims we are self powered,
      but we were returning not self powered to USB_REQ_GET_STATUS control message.
      
      In practice, this message is not sent by a linux 2.6.35.10-74.fc14.x86_64
      guest (not tested on other guests), unless you issue lsusb -v as root (for
      example).
      36707144
    • P
      hw/versatilepb, realview: Fix condition for instantiation of onboard NIC · e6b3c8ca
      Peter Maydell 提交于
      Correct the condition determining whether we instantiate the onboard
      NIC or a PCI card NIC on VersatilePB and Realview boards. This was broken
      in two ways:
       (1) if the user asked for two default NICs ("-net nic -net nic") we would
      crash trying to strcmp() a NULL pointer
       (2) if the user asked for two NICs explicitly of the same model as the
      onboard NIC (eg "-net nic,model=smc91c111 -net nic,model=smc91c111")
      we would try to instantiate two onboard NICs at the same address.
      Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      e6b3c8ca
    • M
      pcnet: Fix sign extension: make ipxe work with >2G RAM · 366c9332
      Michael Brown 提交于
      The problem is with definitions in hw/pcnet.c such as:
      
        #define CSR_CRDA(S)      ((S)->csr[28] | ((S)->csr[29] << 16))
      
      "(S)->csr[29]" is a uint16_t, but "(S)->csr[29] << 16" gets promoted to
      int, so the overall CSR_CRDA(s) is a (signed) int rather than a uint32_t.
      
      This then gets assigned to a uint64_t using
      
        target_phys_addr_t crda = CSR_CRDA(s);
      
      so when (S)->csr[29] has the high bit set, we end up with
      crda=0xffffffffxxxxxxxx.
      
      From: Michael Brown <mcb30@ipxe.org>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Reviewed-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      366c9332
    • B
      lsi53c895a: add support for ABORT messages · 508240c0
      Bernhard Kohl 提交于
      If these messages are not handled correctly the guest driver may hang.
      
      Always mandatory:
      - ABORT
      - BUS DEVICE RESET
      
      Mandatory if tagged queuing is implemented (which disks usually do):
      - ABORT TAG
      - CLEAR QUEUE
      Signed-off-by: NBernhard Kohl <bernhard.kohl@nsn.com>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      508240c0
    • W
      fix build errors when we enable acpi_piix4 debug · 59df4c11
      Wen Congyang 提交于
      I enable acpi_piix4 debug, and got the following build errors:
      # make
        CC    libhw64/acpi_piix4.o
      cc1: warnings being treated as errors
      /home/wency/source/qemu/hw/acpi_piix4.c: In function ‘pm_ioport_write’:
      /home/wency/source/qemu/hw/acpi_piix4.c:193: error: format ‘%04x’ expects type ‘unsigned int’, but argument 2 has type ‘uint64_t’
      /home/wency/source/qemu/hw/acpi_piix4.c:193: error: format ‘%04x’ expects type ‘unsigned int’, but argument 3 has type ‘uint64_t’
      /home/wency/source/qemu/hw/acpi_piix4.c: In function ‘pm_ioport_read’:
      /home/wency/source/qemu/hw/acpi_piix4.c:219: error: format ‘%04x’ expects type ‘unsigned int’, but argument 2 has type ‘uint64_t’
      make[1]: *** [acpi_piix4.o] Error 1
      make: *** [subdir-libhw64] Error 2
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      59df4c11
    • D
      Add SLOF-based partition firmware for pSeries machine, allowing more boot options · a9f8ad8f
      David Gibson 提交于
      Currently, the emulated pSeries machine requires the use of the
      -kernel parameter in order to explicitly load a guest kernel.  This
      means booting from the virtual disk, cdrom or network is not possible.
      
      This patch addresses this limitation by inserting a within-partition
      firmware image (derived from the "SLOF" free Open Firmware project).
      If -kernel is not specified, qemu will now load the SLOF image, which
      has access to the qemu boot device list through the device tree, and
      can boot from any of the usual virtual devices.
      
      In order to support the new firmware, an extension to the emulated
      machine/hypervisor is necessary.  Unlike Linux, which expects
      multi-CPU entry to be handled kexec() style, the SLOF firmware expects
      only one CPU to be active at entry, and to use a hypervisor RTAS
      method to enable the other CPUs one by one.
      
      This patch also implements this 'start-cpu' method, so that SLOF can
      start the secondary CPUs and marshal them into the kexec() holding
      pattern ready for entry into the guest OS.  Linux should, and in the
      future might directly use the start-cpu method to enable initially
      disabled CPUs, but for now it does require kexec() entry.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      a9f8ad8f
    • D
      Implement PAPR VPA functions for pSeries shared processor partitions · ed120055
      David Gibson 提交于
      Shared-processor partitions are those where a CPU is time-sliced between
      partitions, rather than being permanently dedicated to a single
      partition.  qemu emulated partitions, since they are just scheduled with
      the qemu user process, behave mostly like shared processor partitions.
      
      In order to better support shared processor partitions (splpar), PAPR
      defines the "VPA" (Virtual Processor Area), a shared memory communication
      channel between the hypervisor and partitions.  There are also two
      additional shared memory communication areas for specialized purposes
      associated with the VPA.
      
      A VPA is not essential for operating an splpar, though it can be necessary
      for obtaining accurate performance measurements in the presence of
      runtime partition switching.
      
      Most importantly, however, the VPA is a prerequisite for PAPR's H_CEDE,
      hypercall, which allows a partition OS to give up it's shared processor
      timeslices to other partitions when idle.
      
      This patch implements the VPA and H_CEDE hypercalls in qemu.  We don't
      implement any of the more advanced statistics which can be communicated
      through the VPA.  However, this is enough to make normal pSeries kernels
      do an effective power-save idle on an emulated pSeries, significantly
      reducing the host load of a qemu emulated pSeries running an idle guest OS.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ed120055
    • B
      Add a PAPR TCE-bypass mechanism for the pSeries machine · 08942ac1
      Ben Herrenschmidt 提交于
      Usually, PAPR virtual IO devices use a virtual IOMMU mechanism, TCEs,
      to mediate all DMA transfers.  While this is necessary for some sorts of
      operation, it can be complex to program and slow for others.
      
      This patch implements a mechanism for bypassing TCE translation, treating
      "IO" addresses as plain (guest) physical memory addresses.  This has two
      main uses:
       * Simple, but 64-bit aware programs like firmwares can use the VIO devices
      without the complexity of TCE setup.
       * The guest OS can optionally use the TCE bypass to improve performance in
      suitable situations.
      
      The mechanism used is a per-device flag which disables TCE translation.
      The flag is toggled with some (hypervisor-implemented) RTAS methods.
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      08942ac1
    • B
      Implement PAPR virtual SCSI interface (ibmvscsi) · 6e270446
      Ben Herrenschmidt 提交于
      This patch implements the infrastructure and hypercalls necessary for
      the PAPR specified Virtual SCSI interface.  This is the normal method
      for providing (virtual) disks to PAPR partitions.
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      6e270446
    • B
      Implement PAPR CRQ hypercalls · b45d63b6
      Ben Herrenschmidt 提交于
      This patch implements the infrastructure and hypercalls necessary for the
      PAPR specified CRQ (Command Request Queue) mechanism.  This general
      request queueing system is used by many of the PAPR virtual IO devices,
      including the virtual scsi adapter.
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b45d63b6
    • D
      Implement sPAPR Virtual LAN (ibmveth) · 8d90ad90
      David Gibson 提交于
      This patch implements the PAPR specified Inter Virtual Machine Logical
      LAN; that is the virtual hardware used by the Linux ibmveth driver.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      8d90ad90
    • D
      Implement TCE translation for sPAPR VIO · ee86dfee
      David Gibson 提交于
      This patch implements the necessary infrastructure and hypercalls for
      sPAPR's TCE (Translation Control Entry) IOMMU mechanism.  This is necessary
      for all virtual IO devices which do DMA (i.e. nearly all of them).
      Signed-off-by: NBen Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      ee86dfee
    • D
      Add (virtual) interrupt to PAPR virtual tty device · 0201e2da
      David Gibson 提交于
      Now that we have implemented the PAPR "xics" virtualized interrupt
      controller, we can add interrupts in PAPR VIO devices.  This patch adds
      interrupt support to the PAPR virtual tty/console device.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      0201e2da
    • D
      Add PAPR H_VIO_SIGNAL hypercall and infrastructure for VIO interrupts · 00dc738d
      David Gibson 提交于
      This patch adds infrastructure to support interrupts from PAPR virtual IO
      devices.  This includes correctly advertising those interrupts in the
      device tree, and implementing the H_VIO_SIGNAL hypercall, used to
      enable and disable individual device interrupts.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      00dc738d
    • D
      Implement the PAPR (pSeries) virtualized interrupt controller (xics) · b5cec4c5
      David Gibson 提交于
      PAPR defines an interrupt control architecture which is logically divided
      into ICS (Interrupt Control Presentation, each unit is responsible for
      presenting interrupts to a particular "interrupt server", i.e. CPU) and
      ICS (Interrupt Control Source, each unit responsible for one or more
      hardware interrupts as numbered globally across the system).  All PAPR
      virtual IO devices expect to deliver interrupts via this mechanism.  In
      Linux, this interrupt controller system is handled by the "xics" driver.
      
      On pSeries systems, access to the interrupt controller is virtualized via
      hypercalls and RTAS methods.  However, the virtualized interface is very
      similar to the underlying interrupt controller hardware, and similar PICs
      exist un-virtualized in some other systems.
      
      This patch implements both the ICP and ICS sides of the PAPR interrupt
      controller.  For now, only the hypercall virtualized interface is provided,
      however it would be relatively straightforward to graft an emulated
      register interface onto the underlying interrupt logic if we want to add
      a machine with a hardware ICS/ICP system in the future.
      
      There are some limitations in this implementation: it is assumed for now
      that only one instance of the ICS exists, although a full xics system can
      have several, each responsible for a different group of hardware irqs.
      ICP/ICS can handle both level-sensitve (LSI) and message signalled (MSI)
      interrupt inputs.  For now, this implementation supports only MSI
      interrupts, since that is used by PAPR virtual IO devices.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      b5cec4c5
    • D
      Implement assorted pSeries hcalls and RTAS methods · 821303f5
      David Gibson 提交于
      This patch adds several small utility hypercalls and RTAS methods to
      the pSeries platform emulation.  Specifically:
      
      * 'display-character' rtas call
      
      This just prints a character to the console, it's occasionally used
      for early debug of the OS.  The support includes a hack to make this
      RTAS call respond on the normal token value present on real hardware,
      since some early debugging tools just assume this value without
      checking the device tree.
      
      * 'get-time-of-day' rtas call
      
      This one just takes the host real time, converts to the PAPR described
      format and returns it to the guest.
      
      * 'power-off' rtas call
      
      This one shuts down the emulated system.
      
      * H_DABR hypercall
      
      On pSeries, the DABR debug register is usually a hypervisor resource
      and virtualized through this hypercall.  If the hypercall is not
      present, Linux will under some circumstances attempt to manipulate the
      DABR directly which will fail on this emulated machine.
      
      This stub implementation is enough to stop that behaviour, although it
      doesn't actually implement the requested DABR operations as yet.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      821303f5
    • D
      Implement hcall based RTAS for pSeries machines · 39ac8455
      David Gibson 提交于
      On pSeries machines, operating systems can instantiate "RTAS" (Run-Time
      Abstraction Services), a runtime component of the firmware which implements
      a number of low-level, infrequently used operations.  On logical partitions
      under a hypervisor, many of the RTAS functions require hypervisor
      privilege.  For simplicity, therefore, hypervisor systems typically
      implement the in-partition RTAS as just a tiny wrapper around a hypercall
      which actually implements the various RTAS functions.
      
      This patch implements such a hypercall based RTAS for our emulated pSeries
      machine.  A tiny in-partition "firmware" calls a new hypercall, which
      looks up available RTAS services in a table.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      39ac8455
    • D
      Virtual hash page table handling on pSeries machine · f43e3525
      David Gibson 提交于
      On pSeries logical partitions, excepting the old POWER4-style full system
      partitions, the guest does not have direct access to the hardware page
      table.  Instead, the pagetable exists in hypervisor memory, and the guest
      must manipulate it with hypercalls.
      
      However, our current pSeries emulation more closely resembles the old
      style where the guest must set up and handle the pagetables itself.  This
      patch converts it to act like a modern partition.
      
      This involves two things: first, the hash translation path is modified to
      permit the has table to be stored externally to the emulated machine's
      RAM.  The pSeries machine init code configures the CPUs to use this mode.
      
      Secondly, we emulate the PAPR hypercalls for manipulating the external
      hashed page table.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      f43e3525
    • D
      Implement the bus structure for PAPR virtual IO · 4040ab72
      David Gibson 提交于
      This extends the "pseries" (PAPR) machine to include a virtual IO bus
      supporting the PAPR defined hypercall based virtual IO mechanisms.
      
      So far only one VIO device is provided, the vty / vterm, providing
      a full console (polled only, for now).
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      4040ab72
    • D
      Start implementing pSeries logical partition machine · 9fdf0c29
      David Gibson 提交于
      This patch adds a "pseries" machine to qemu.  This aims to emulate a
      logical partition on an IBM pSeries machine, compliant to the
      "PowerPC Architecture Platform Requirements" (PAPR) document.
      
      This initial version is quite limited, it implements a basic machine
      and PAPR hypercall emulation.  So far only one hypercall is present -
      H_PUT_TERM_CHAR - so that a (write-only) console is available.
      
      Multiple CPUs are permitted, with SMP entry handled kexec() style.
      
      The machine so far more resembles an old POWER4 style "full system
      partition" rather than a modern LPAR, in that the guest manages the
      page tables directly, rather than via hypercalls.
      
      The machine requires qemu to be configured with --enable-fdt.  The
      machine can (so far) only be booted with -kernel - i.e. no partition
      firmware is provided.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9fdf0c29
    • D
      Add POWER7 support for ppc · 9d52e907
      David Gibson 提交于
      This adds emulation support for the recent POWER7 cpu to qemu.  It's far
      from perfect - it's missing a number of POWER7 features so far, including
      any support for VSX or decimal floating point instructions.  However, it's
      close enough to boot a kernel with the POWER7 PVR.
      Signed-off-by: NDavid Gibson <dwg@au1.ibm.com>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      9d52e907
  3. 29 3月, 2011 1 次提交