All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL v2 00/25] Misc patches for 2022-04-29
@ 2022-04-30  9:25 Paolo Bonzini
  2022-04-30  9:25 ` [PULL v2 01/25] WHPX: support for xcr0 Paolo Bonzini
  2022-04-30 12:47 ` [PULL v2 00/25] Misc patches for 2022-04-29 Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-04-30  9:25 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 731340813fdb4cb8339edb8630e3f923b7d987ec:

  Merge tag 'pull-riscv-to-apply-20220429' of github.com:alistair23/qemu into staging (2022-04-29 08:46:55 -0700)

are available in the Git repository at:

  https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 189fad0006dd4f2f336e05a99d981cc1ecab1b33:

  pc: remove -soundhw pcspk (2022-04-30 10:10:05 +0200)

----------------------------------------------------------------
* WHPX support for xcr0
* qga-wss fixes
* Meson conversions
* Removed -soundhw pcspk

----------------------------------------------------------------
v1->v2: fix WHPX build

Konstantin Kostiuk (2):
      configure: Add cross prefix for widl tool
      qga-vss: always build qga-vss.tlb when qga-vss.dll is built

Paolo Bonzini (22):
      meson-buildoptions: add support for string options
      meson, configure: move Xen detection to meson
      configure, meson: move iasl detection to meson
      configure: move Windows flags detection to meson
      configure: switch string options to automatic parsing
      meson, configure: move --tls-priority to meson
      meson, configure: move bdrv whitelists to meson
      meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
      meson, configure: move --interp-prefix to meson
      meson: always combine directories with prefix
      configure: switch directory options to automatic parsing
      meson: pass more options directly as -D
      configure: omit options with default values from meson command line
      meson, virtio: place all virtio-pci devices under virtio_pci_ss
      configure: simplify vhost-net-{user, vdpa} configuration
      build: move vhost-vsock configuration to Kconfig
      build: move vhost-scsi configuration to Kconfig
      build: move vhost-user-fs configuration to Kconfig
      meson: create have_vhost_* variables
      meson: use have_vhost_* variables to pick sources
      configure, meson: move vhost options to Meson
      pc: remove -soundhw pcspk

Sunil Muthuswamy (1):
      WHPX: support for xcr0

 Kconfig.host                     |   3 -
 backends/meson.build             |   8 +-
 configure                        | 673 ++-------------------------------------
 docs/meson.build                 |   2 +-
 hw/audio/pcspk.c                 |  10 -
 hw/audio/soundhw.c               |  27 +-
 hw/net/meson.build               |   8 +-
 hw/scsi/Kconfig                  |   5 +
 hw/virtio/Kconfig                |  18 +-
 hw/virtio/meson.build            |  34 +-
 include/hw/audio/soundhw.h       |   3 -
 include/hw/virtio/virtio-scsi.h  |   2 -
 meson.build                      | 256 +++++++++++----
 meson_options.txt                |  28 +-
 net/meson.build                  |  12 +-
 qga/vss-win32/meson.build        |   4 +-
 scripts/meson-buildoptions.py    |  86 ++++-
 scripts/meson-buildoptions.sh    |  74 ++++-
 scripts/qemu-stamp.py            |  24 ++
 scripts/xen-detect.c             | 203 ++++++++++++
 target/i386/whpx/whpx-all.c      |  89 ++++++
 target/i386/whpx/whpx-internal.h |   3 +
 tests/meson.build                |   2 +-
 tests/qtest/meson.build          |   4 +-
 tools/meson.build                |   2 +-
 25 files changed, 778 insertions(+), 802 deletions(-)
 create mode 100644 scripts/qemu-stamp.py
 create mode 100644 scripts/xen-detect.c
-- 
2.35.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL v2 01/25] WHPX: support for xcr0
  2022-04-30  9:25 [PULL v2 00/25] Misc patches for 2022-04-29 Paolo Bonzini
@ 2022-04-30  9:25 ` Paolo Bonzini
  2022-04-30 12:47 ` [PULL v2 00/25] Misc patches for 2022-04-29 Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-04-30  9:25 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sunil Muthuswamy

From: Sunil Muthuswamy <sunilmut@microsoft.com>

Support for xcr0 to be able to enable xsave/xrstor. This by itself
is not sufficient to enable xsave/xrstor. WHPX XSAVE API's also
needs to be hooked up.

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Message-Id: <MW2PR2101MB1116F07C07A26FD7A7ED8DCFC0780@MW2PR2101MB1116.namprd21.prod.outlook.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/whpx/whpx-all.c      | 87 ++++++++++++++++++++++++++++++++
 target/i386/whpx/whpx-internal.h |  3 ++
 2 files changed, 90 insertions(+)

diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index b625ad5bbb..23ae639b23 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -246,9 +246,15 @@ static bool whpx_allowed;
 static bool whp_dispatch_initialized;
 static HMODULE hWinHvPlatform, hWinHvEmulation;
 static uint32_t max_vcpu_index;
+static WHV_PROCESSOR_XSAVE_FEATURES whpx_xsave_cap;
+
 struct whpx_state whpx_global;
 struct WHPDispatch whp_dispatch;
 
+static bool whpx_has_xsave(void)
+{
+    return whpx_xsave_cap.XsaveSupport;
+}
 
 /*
  * VP support
@@ -300,6 +306,28 @@ static SegmentCache whpx_seg_h2q(const WHV_X64_SEGMENT_REGISTER *hs)
     return qs;
 }
 
+/* X64 Extended Control Registers */
+static void whpx_set_xcrs(CPUState *cpu)
+{
+    CPUX86State *env = cpu->env_ptr;
+    HRESULT hr;
+    struct whpx_state *whpx = &whpx_global;
+    WHV_REGISTER_VALUE xcr0;
+    WHV_REGISTER_NAME xcr0_name = WHvX64RegisterXCr0;
+
+    if (!whpx_has_xsave()) {
+        return;
+    }
+
+    /* Only xcr0 is supported by the hypervisor currently */
+    xcr0.Reg64 = env->xcr0;
+    hr = whp_dispatch.WHvSetVirtualProcessorRegisters(
+        whpx->partition, cpu->cpu_index, &xcr0_name, 1, &xcr0);
+    if (FAILED(hr)) {
+        error_report("WHPX: Failed to set register xcr0, hr=%08lx", hr);
+    }
+}
+
 static int whpx_set_tsc(CPUState *cpu)
 {
     CPUX86State *env = cpu->env_ptr;
@@ -435,6 +463,12 @@ static void whpx_set_registers(CPUState *cpu, int level)
 
     /* 8 Debug Registers - Skipped */
 
+    /*
+     * Extended control registers needs to be handled separately depending
+     * on whether xsave is supported/enabled or not.
+     */
+    whpx_set_xcrs(cpu);
+
     /* 16 XMM registers */
     assert(whpx_register_names[idx] == WHvX64RegisterXmm0);
     idx_next = idx + 16;
@@ -541,6 +575,30 @@ static int whpx_get_tsc(CPUState *cpu)
     return 0;
 }
 
+/* X64 Extended Control Registers */
+static void whpx_get_xcrs(CPUState *cpu)
+{
+    CPUX86State *env = cpu->env_ptr;
+    HRESULT hr;
+    struct whpx_state *whpx = &whpx_global;
+    WHV_REGISTER_VALUE xcr0;
+    WHV_REGISTER_NAME xcr0_name = WHvX64RegisterXCr0;
+
+    if (!whpx_has_xsave()) {
+        return;
+    }
+
+    /* Only xcr0 is supported by the hypervisor currently */
+    hr = whp_dispatch.WHvGetVirtualProcessorRegisters(
+        whpx->partition, cpu->cpu_index, &xcr0_name, 1, &xcr0);
+    if (FAILED(hr)) {
+        error_report("WHPX: Failed to get register xcr0, hr=%08lx", hr);
+        return;
+    }
+
+    env->xcr0 = xcr0.Reg64;
+}
+
 static void whpx_get_registers(CPUState *cpu)
 {
     struct whpx_state *whpx = &whpx_global;
@@ -634,6 +692,12 @@ static void whpx_get_registers(CPUState *cpu)
 
     /* 8 Debug Registers - Skipped */
 
+    /*
+     * Extended control registers needs to be handled separately depending
+     * on whether xsave is supported/enabled or not.
+     */
+    whpx_get_xcrs(cpu);
+
     /* 16 XMM registers */
     assert(whpx_register_names[idx] == WHvX64RegisterXmm0);
     idx_next = idx + 16;
@@ -2513,6 +2577,29 @@ static int whpx_accel_init(MachineState *ms)
         goto error;
     }
 
+    /*
+     * Query the XSAVE capability of the partition. Any error here is not
+     * considered fatal.
+     */
+    hr = whp_dispatch.WHvGetPartitionProperty(
+        whpx->partition,
+        WHvPartitionPropertyCodeProcessorXsaveFeatures,
+        &whpx_xsave_cap,
+        sizeof(whpx_xsave_cap),
+        &whpx_cap_size);
+
+    /*
+     * Windows version which don't support this property will return with the
+     * specific error code.
+     */
+    if (FAILED(hr) && hr != WHV_E_UNKNOWN_PROPERTY) {
+        error_report("WHPX: Failed to query XSAVE capability, hr=%08lx", hr);
+    }
+
+    if (!whpx_has_xsave()) {
+        printf("WHPX: Partition is not XSAVE capable\n");
+    }
+
     memset(&prop, 0, sizeof(WHV_PARTITION_PROPERTY));
     prop.ProcessorCount = ms->smp.cpus;
     hr = whp_dispatch.WHvSetPartitionProperty(
diff --git a/target/i386/whpx/whpx-internal.h b/target/i386/whpx/whpx-internal.h
index 2416ec7922..dbb7e7ba82 100644
--- a/target/i386/whpx/whpx-internal.h
+++ b/target/i386/whpx/whpx-internal.h
@@ -48,6 +48,9 @@ void whpx_apic_get(DeviceState *s);
 
 #define WHV_E_UNKNOWN_CAPABILITY 0x80370300L
 
+/* This should eventually come from the Windows SDK */
+#define WHV_E_UNKNOWN_PROPERTY 0x80370302
+
 #define LIST_WINHVPLATFORM_FUNCTIONS(X) \
   X(HRESULT, WHvGetCapability, (WHV_CAPABILITY_CODE CapabilityCode, VOID* CapabilityBuffer, UINT32 CapabilityBufferSizeInBytes, UINT32* WrittenSizeInBytes)) \
   X(HRESULT, WHvCreatePartition, (WHV_PARTITION_HANDLE* Partition)) \
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL v2 00/25] Misc patches for 2022-04-29
  2022-04-30  9:25 [PULL v2 00/25] Misc patches for 2022-04-29 Paolo Bonzini
  2022-04-30  9:25 ` [PULL v2 01/25] WHPX: support for xcr0 Paolo Bonzini
@ 2022-04-30 12:47 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-04-30 12:47 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 4/30/22 02:25, Paolo Bonzini wrote:
> The following changes since commit 731340813fdb4cb8339edb8630e3f923b7d987ec:
> 
>    Merge tag 'pull-riscv-to-apply-20220429' of github.com:alistair23/qemu into staging (2022-04-29 08:46:55 -0700)
> 
> are available in the Git repository at:
> 
>    https://gitlab.com/bonzini/qemu.git tags/for-upstream
> 
> for you to fetch changes up to 189fad0006dd4f2f336e05a99d981cc1ecab1b33:
> 
>    pc: remove -soundhw pcspk (2022-04-30 10:10:05 +0200)
> 
> ----------------------------------------------------------------
> * WHPX support for xcr0
> * qga-wss fixes
> * Meson conversions
> * Removed -soundhw pcspk
> 
> ----------------------------------------------------------------
> v1->v2: fix WHPX build
> 
> Konstantin Kostiuk (2):
>        configure: Add cross prefix for widl tool
>        qga-vss: always build qga-vss.tlb when qga-vss.dll is built
> 
> Paolo Bonzini (22):
>        meson-buildoptions: add support for string options
>        meson, configure: move Xen detection to meson
>        configure, meson: move iasl detection to meson
>        configure: move Windows flags detection to meson
>        configure: switch string options to automatic parsing
>        meson, configure: move --tls-priority to meson
>        meson, configure: move bdrv whitelists to meson
>        meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
>        meson, configure: move --interp-prefix to meson
>        meson: always combine directories with prefix
>        configure: switch directory options to automatic parsing
>        meson: pass more options directly as -D
>        configure: omit options with default values from meson command line
>        meson, virtio: place all virtio-pci devices under virtio_pci_ss
>        configure: simplify vhost-net-{user, vdpa} configuration
>        build: move vhost-vsock configuration to Kconfig
>        build: move vhost-scsi configuration to Kconfig

One more failure, in the centos-stream-8-x86_64 job:

  ERROR: unknown option --disable-vhost-scsi

https://gitlab.com/qemu-project/qemu/-/jobs/2398420231

 From the patch description for vhost-scsi above, it looks like you merely need to edit 
the gitlab ci file.


r~


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-30 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-30  9:25 [PULL v2 00/25] Misc patches for 2022-04-29 Paolo Bonzini
2022-04-30  9:25 ` [PULL v2 01/25] WHPX: support for xcr0 Paolo Bonzini
2022-04-30 12:47 ` [PULL v2 00/25] Misc patches for 2022-04-29 Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.