Skip to content
Snippets Groups Projects
  1. May 28, 2022
  2. May 26, 2022
  3. May 25, 2022
  4. May 19, 2022
    • Peter Maydell's avatar
      ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY · 9598c1bb
      Peter Maydell authored
      
      The traditional ptimer behaviour includes a collection of weird edge
      case behaviours.  In 2016 we improved the ptimer implementation to
      fix these and generally make the behaviour more flexible, with
      ptimers opting in to the new behaviour by passing an appropriate set
      of policy flags to ptimer_init().  For backwards-compatibility, we
      defined PTIMER_POLICY_DEFAULT (which sets no flags) to give the old
      weird behaviour.
      
      This turns out to be a poor choice of name, because people writing
      new devices which use ptimers are misled into thinking that the
      default is probably a sensible choice of flags, when in fact it is
      almost always not what you want.  Rename PTIMER_POLICY_DEFAULT to
      PTIMER_POLICY_LEGACY and beef up the comment to more clearly say that
      new devices should not be using it.
      
      The code-change part of this commit was produced by
        sed -i -e 's/PTIMER_POLICY_DEFAULT/PTIMER_POLICY_LEGACY/g' $(git grep -l PTIMER_POLICY_DEFAULT)
      with the exception of a test name string change in
      tests/unit/ptimer-test.c which was added manually.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarFrancisco Iglesias <francisco.iglesias@amd.com>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20220516103058.162280-1-peter.maydell@linaro.org
      9598c1bb
    • Philippe Mathieu-Daudé's avatar
      hw/adc/zynq-xadc: Use qemu_irq typedef · 6e76d35f
      Philippe Mathieu-Daudé authored
      
      Except hw/core/irq.c which implements the forward-declared opaque
      qemu_irq structure, hw/adc/zynq-xadc.{c,h} are the only files not
      using the typedef. Fix this single exception.
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Reviewed-by: default avatarBernhard Beschow <shentey@gmail.com>
      Message-id: 20220509202035.50335-1-philippe.mathieu.daude@gmail.com
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      6e76d35f
    • Peter Maydell's avatar
      hw/intc/arm_gicv3: Use correct number of priority bits for the CPU · 39f29e59
      Peter Maydell authored
      
      Make the GICv3 set its number of bits of physical priority from the
      implementation-specific value provided in the CPU state struct, in
      the same way we already do for virtual priority bits.  Because this
      would be a migration compatibility break, we provide a property
      force-8-bit-prio which is enabled for 7.0 and earlier versioned board
      models to retain the legacy "always use 8 bits" behaviour.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20220512151457.3899052-6-peter.maydell@linaro.org
      Message-id: 20220506162129.2896966-5-peter.maydell@linaro.org
      39f29e59
    • Peter Maydell's avatar
      hw/intc/arm_gicv3: Support configurable number of physical priority bits · 84597ff3
      Peter Maydell authored
      
      The GICv3 code has always supported a configurable number of virtual
      priority and preemption bits, but our implementation currently
      hardcodes the number of physical priority bits at 8.  This is not
      what most hardware implementations provide; for instance the
      Cortex-A53 provides only 5 bits of physical priority.
      
      Make the number of physical priority/preemption bits driven by fields
      in the GICv3CPUState, the way that we already do for virtual
      priority/preemption bits.  We set cs->pribits to 8, so there is no
      behavioural change in this commit.  A following commit will add the
      machinery for CPUs to set this to the correct value for their
      implementation.
      
      Note that changing the number of priority bits would be a migration
      compatibility break, because the semantics of the icc_apr[][] array
      changes.
      
      Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
      Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
      Message-id: 20220512151457.3899052-5-peter.maydell@linaro.org
      Message-id: 20220506162129.2896966-4-peter.maydell@linaro.org
      84597ff3
  5. May 18, 2022
    • Thomas Huth's avatar
      docs/about: Update the support statement for Windows · 0ce9b08c
      Thomas Huth authored
      Our support statement for Windows currently talks about "Vista / Server
      2008" - which is related to the API of Windows, and this is not easy
      to understand for the non-technical users. Additionally, glib sets the
      _WIN32_WINNT macro to 0x0601 already, which indicates the Windows 7 API,
      so QEMU effectively depends on the Windows 7 API, too.
      
      Thus let's bump the _WIN32_WINNT setting in QEMU to the same level as
      glib uses and adjust our support statement in the documentation to
      something similar that we're using for Linux and the *BSD systems
      (i.e. only the two most recent versions), which should hopefully be
      easier to understand for the users now.
      
      And since we're nowadays also compile-testing QEMU with MSYS2 on Windows
      itself, I think we could mention this build environment here, too.
      
      Resolves: https://gitlab.com/qemu-project/qemu/-/issues/880
      
      
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Reviewed-by: default avatarStefan Weil <sw@weilnetz.de>
      Message-Id: <20220513063958.1181443-1-thuth@redhat.com>
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      0ce9b08c
  6. May 16, 2022
  7. May 14, 2022
  8. May 13, 2022
    • Alex Williamson's avatar
      linux-headers: Update to v5.18-rc6 · e4082063
      Alex Williamson authored
      
      Update to c5eb0a61238d ("Linux 5.18-rc6").  Mechanical search and
      replace of vfio defines with white space massaging.
      
      Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      e4082063
    • Jonathan Cameron's avatar
      cxl/cxl-host: Add memops for CFMWS region. · eb19d907
      Jonathan Cameron authored
      
      These memops perform interleave decoding, walking down the
      CXL topology from CFMWS described host interleave
      decoder via CXL host bridge HDM decoders, through the CXL
      root ports and finally call CXL type 3 specific read and write
      functions.
      
      Note that, whilst functional the current implementation does
      not support:
      * switches
      * multiple HDM decoders at a given level.
      * unaligned accesses across the interleave boundaries
      
      Signed-off-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
      Message-Id: <20220429144110.25167-34-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      eb19d907
    • Jonathan Cameron's avatar
      mem/cxl_type3: Add read and write functions for associated hostmem. · 5fcc499e
      Jonathan Cameron authored
      Once a read or write reaches a CXL type 3 device, the HDM decoders
      on the device are used to establish the Device Physical Address
      which should be accessed.  These functions peform the required maths
      and then use a device specific address space to access the
      hostmem->mr to fullfil the actual operation.  Note that failed writes
      are silent, but failed reads return poison.  Note this is based
      loosely on:
      
      https://lore.kernel.org/qemu-devel/20200817161853.593247-6-f4bug@amsat.org/
      
      
      [RFC PATCH 0/9] hw/misc: Add support for interleaved memory accesses
      
      Only lightly tested so far.  More complex test cases yet to be written.
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Message-Id: <20220429144110.25167-33-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      5fcc499e
    • Jonathan Cameron's avatar
      CXL/cxl_component: Add cxl_get_hb_cstate() · 0b4aec24
      Jonathan Cameron authored
      
      Accessor to get hold of the cxl state for a CXL host bridge
      without exposing the internals of the implementation.
      
      Signed-off-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20220429144110.25167-32-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      0b4aec24
    • Jonathan Cameron's avatar
      pci/pcie_port: Add pci_find_port_by_pn() · aa970ed5
      Jonathan Cameron authored
      
      Simple function to search a PCIBus to find a port by
      it's port number.
      
      CXL interleave decoding uses the port number as a target
      so it is necessary to locate the port when doing interleave
      decoding.
      
      Signed-off-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20220429144110.25167-31-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      aa970ed5
    • Jonathan Cameron's avatar
      hw/cxl/host: Add support for CXL Fixed Memory Windows. · aadfe320
      Jonathan Cameron authored
      
      The concept of these is introduced in [1] in terms of the
      description the CEDT ACPI table. The principal is more general.
      Unlike once traffic hits the CXL root bridges, the host system
      memory address routing is implementation defined and effectively
      static once observable by standard / generic system software.
      Each CXL Fixed Memory Windows (CFMW) is a region of PA space
      which has fixed system dependent routing configured so that
      accesses can be routed to the CXL devices below a set of target
      root bridges. The accesses may be interleaved across multiple
      root bridges.
      
      For QEMU we could have fully specified these regions in terms
      of a base PA + size, but as the absolute address does not matter
      it is simpler to let individual platforms place the memory regions.
      
      ExampleS:
      -cxl-fixed-memory-window targets.0=cxl.0,size=128G
      -cxl-fixed-memory-window targets.0=cxl.1,size=128G
      -cxl-fixed-memory-window targets.0=cxl0,targets.1=cxl.1,size=256G,interleave-granularity=2k
      
      Specifies
      * 2x 128G regions not interleaved across root bridges, one for each of
        the root bridges with ids cxl.0 and cxl.1
      * 256G region interleaved across root bridges with ids cxl.0 and cxl.1
      with a 2k interleave granularity.
      
      When system software enumerates the devices below a given root bridge
      it can then decide which CFMW to use. If non interleave is desired
      (or possible) it can use the appropriate CFMW for the root bridge in
      question.  If there are suitable devices to interleave across the
      two root bridges then it may use the 3rd CFMS.
      
      A number of other designs were considered but the following constraints
      made it hard to adapt existing QEMU approaches to this particular problem.
      1) The size must be known before a specific architecture / board brings
         up it's PA memory map.  We need to set up an appropriate region.
      2) Using links to the host bridges provides a clean command line interface
         but these links cannot be established until command line devices have
         been added.
      
      Hence the two step process used here of first establishing the size,
      interleave-ways and granularity + caching the ids of the host bridges
      and then, once available finding the actual host bridges so they can
      be used later to support interleave decoding.
      
      [1] CXL 2.0 ECN: CEDT CFMWS & QTG DSM (computeexpresslink.org / specifications)
      
      Signed-off-by: default avatarJonathan Cameron <jonathan.cameron@huawei.com>
      Acked-by: Markus Armbruster <armbru@redhat.com> # QAPI Schema
      Message-Id: <20220429144110.25167-28-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      aadfe320
    • Jonathan Cameron's avatar
      hw/cxl/component: Add utils for interleave parameter encoding/decoding · 829de299
      Jonathan Cameron authored
      
      Both registers and the CFMWS entries in CDAT use simple encodings
      for the number of interleave ways and the interleave granularity.
      Introduce simple conversion functions to/from the unencoded
      number / size.  So far the iw decode has not been needed so is
      it not implemented.
      
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20220429144110.25167-27-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      829de299
    • Ben Widawsky's avatar
      acpi/cxl: Create the CEDT (9.14.1) · 3d6a69b6
      Ben Widawsky authored
      The CXL Early Discovery Table is defined in the CXL 2.0 specification as
      a way for the OS to get CXL specific information from the system
      firmware.
      
      CXL 2.0 specification adds an _HID, ACPI0016, for CXL capable host
      bridges, with a _CID of PNP0A08 (PCIe host bridge). CXL aware software
      is able to use this initiate the proper _OSC method, and get the _UID
      which is referenced by the CEDT. Therefore the existence of an ACPI0016
      device allows a CXL aware driver perform the necessary actions. For a
      CXL capable OS, this works. For a CXL unaware OS, this works.
      
      CEDT awaremess requires more. The motivation for ACPI0017 is to provide
      the possibility of having a Linux CXL module that can work on a legacy
      Linux kernel. Linux core PCI/ACPI which won't be built as a module,
      will see the _CID of PNP0A08 and bind a driver to it. If we later loaded
      a driver for ACPI0016, Linux won't be able to bind it to the hardware
      because it has already bound the PNP0A08 driver. The ACPI0017 device is
      an opportunity to have an object to bind a driver will be used by a
      Linux driver to walk the CXL topology and do everything that we would
      have preferred to do with ACPI0016.
      
      There is another motivation for an ACPI0017 device which isn't
      implemented here. An operating system needs an attach point for a
      non-volatile region provider that understands cross-hostbridge
      interleaving. Since QEMU emulation doesn't support interleaving yet,
      this is more important on the OS side, for now.
      
      As of CXL 2.0 spec, only 1 sub structure is defined, the CXL Host Bridge
      Structure (CHBS) which is primarily useful for telling the OS exactly
      where the MMIO for the host bridge is.
      
      Link: https://lore.kernel.org/linux-cxl/20210115034911.nkgpzc756d6qmjpl@intel.com/T/#t
      
      
      Signed-off-by: default avatarBen Widawsky <ben.widawsky@intel.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20220429144110.25167-26-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      3d6a69b6
    • Ben Widawsky's avatar
      acpi/cxl: Add _OSC implementation (9.14.2) · 2a3282c6
      Ben Widawsky authored
      
      CXL 2.0 specification adds 2 new dwords to the existing _OSC definition
      from PCIe. The new dwords are accessed with a new uuid. This
      implementation supports what is in the specification.
      
      iasl -d decodes the result of this patch as:
      
      Name (SUPP, Zero)
      Name (CTRL, Zero)
      Name (SUPC, Zero)
      Name (CTRC, Zero)
      Method (_OSC, 4, NotSerialized)  // _OSC: Operating System Capabilities
      {
          CreateDWordField (Arg3, Zero, CDW1)
          If (((Arg0 == ToUUID ("33db4d5b-1ff7-401c-9657-7441c03dd766") /* PCI Host Bridge Device */) || (Arg0 == ToUUID ("68f2d50b-c469-4d8a-bd3d-941a103fd3fc") /* Unknown UUID */)))
          {
              CreateDWordField (Arg3, 0x04, CDW2)
              CreateDWordField (Arg3, 0x08, CDW3)
              Local0 = CDW3 /* \_SB_.PC0C._OSC.CDW3 */
              Local0 &= 0x1F
              If ((Arg1 != One))
              {
                  CDW1 |= 0x08
              }
      
              If ((CDW3 != Local0))
              {
                  CDW1 |= 0x10
              }
      
              SUPP = CDW2 /* \_SB_.PC0C._OSC.CDW2 */
              CTRL = CDW3 /* \_SB_.PC0C._OSC.CDW3 */
              CDW3 = Local0
              If ((Arg0 == ToUUID ("68f2d50b-c469-4d8a-bd3d-941a103fd3fc") /* Unknown UUID */))
              {
                  CreateDWordField (Arg3, 0x0C, CDW4)
                  CreateDWordField (Arg3, 0x10, CDW5)
                  SUPC = CDW4 /* \_SB_.PC0C._OSC.CDW4 */
                  CTRC = CDW5 /* \_SB_.PC0C._OSC.CDW5 */
                  CDW5 |= One
              }
      
              Return (Arg3)
          }
          Else
          {
              CDW1 |= 0x04
              Return (Arg3)
          }
      
      Signed-off-by: default avatarBen Widawsky <ben.widawsky@intel.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Message-Id: <20220429144110.25167-25-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      2a3282c6
    • Ben Widawsky's avatar
      hw/cxl/component: Implement host bridge MMIO (8.2.5, table 142) · 6e4e3ae9
      Ben Widawsky authored
      
      CXL host bridges themselves may have MMIO. Since host bridges don't have
      a BAR they are treated as special for MMIO.  This patch includes
      i386/pc support.
      Also hook up the device reset now that we have have the MMIO
      space in which the results are visible.
      
      Note that we duplicate the PCI express case for the aml_build but
      the implementations will diverge when the CXL specific _OSC is
      introduced.
      
      Signed-off-by: default avatarBen Widawsky <ben.widawsky@intel.com>
      Co-developed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Message-Id: <20220429144110.25167-24-Jonathan.Cameron@huawei.com>
      Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      6e4e3ae9
Loading