From: Paul Durrant <Paul.Durrant@citrix.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>,
Andrew Cooper <Andrew.Cooper3@citrix.com>,
Julien Grall <julien.grall@arm.com>,
"jbeulich@suse.com" <jbeulich@suse.com>,
Ian Jackson <Ian.Jackson@citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH v2 02/11] acpi: Define ACPI IO registers for PVH guests
Date: Wed, 9 Nov 2016 14:48:52 +0000 [thread overview]
Message-ID: <43c7058c6e084e9388b3fff50680c186@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <1478702399-14538-3-git-send-email-boris.ostrovsky@oracle.com>
> -----Original Message-----
> From: Boris Ostrovsky [mailto:boris.ostrovsky@oracle.com]
> Sent: 09 November 2016 14:40
> To: xen-devel@lists.xen.org
> Cc: jbeulich@suse.com; Andrew Cooper <Andrew.Cooper3@citrix.com>;
> Wei Liu <wei.liu2@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Roger
> Pau Monne <roger.pau@citrix.com>; Boris Ostrovsky
> <boris.ostrovsky@oracle.com>; Julien Grall <julien.grall@arm.com>; Paul
> Durrant <Paul.Durrant@citrix.com>
> Subject: [PATCH v2 02/11] acpi: Define ACPI IO registers for PVH guests
>
> ACPI hotplug-related IO accesses (to GPE0 block) are handled
> by qemu for HVM guests. Since PVH guests don't have qemu these
> accesses will need to be procesed by the hypervisor.
>
> Because ACPI event model expects pm1a block to be present we
> need to have the hypervisor emulate it as well.
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
> CC: Julien Grall <julien.grall@arm.com>
> CC: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
> ---
> Changes in v2:
> * Added public macros for ACPI CPU bitmap (at 0xaf00). Note: PRST
> region shrinks from 32 bytes to 16 (when 128 VCPUs are
> supported).
>
>
> tools/libacpi/mk_dsdt.c | 4 +++-
> tools/libacpi/static_tables.c | 28 +++++++++++-----------------
> xen/include/asm-x86/hvm/domain.h | 6 ++++++
> xen/include/public/arch-arm.h | 11 ++++++++---
> xen/include/public/hvm/ioreq.h | 13 +++++++++++++
> 5 files changed, 41 insertions(+), 21 deletions(-)
>
> diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c
> index 4ae68bc..2b8234d 100644
> --- a/tools/libacpi/mk_dsdt.c
> +++ b/tools/libacpi/mk_dsdt.c
> @@ -19,6 +19,7 @@
> #include <stdbool.h>
> #if defined(__i386__) || defined(__x86_64__)
> #include <xen/hvm/hvm_info_table.h>
> +#include <xen/hvm/ioreq.h>
> #elif defined(__aarch64__)
> #include <xen/arch-arm.h>
> #endif
> @@ -244,7 +245,8 @@ int main(int argc, char **argv)
> #endif
>
> /* Operation Region 'PRST': bitmask of online CPUs. */
> - stmt("OperationRegion", "PRST, SystemIO, 0xaf00, 32");
> + stmt("OperationRegion", "PRST, SystemIO, 0x%x, %d",
> + ACPI_CPU_MAP, ACPI_CPU_MAP_LEN);
> push_block("Field", "PRST, ByteAcc, NoLock, Preserve");
> indent(); printf("PRS, %u\n", max_cpus);
> pop_block();
> diff --git a/tools/libacpi/static_tables.c b/tools/libacpi/static_tables.c
> index 617bf68..413abcc 100644
> --- a/tools/libacpi/static_tables.c
> +++ b/tools/libacpi/static_tables.c
> @@ -20,6 +20,8 @@
> * Firmware ACPI Control Structure (FACS).
> */
>
> +#define ACPI_REG_BIT_OFFSET 0
> +
> struct acpi_20_facs Facs = {
> .signature = ACPI_2_0_FACS_SIGNATURE,
> .length = sizeof(struct acpi_20_facs),
> @@ -30,14 +32,6 @@ struct acpi_20_facs Facs = {
> /*
> * Fixed ACPI Description Table (FADT).
> */
> -
> -#define ACPI_PM1A_EVT_BLK_BIT_WIDTH 0x20
> -#define ACPI_PM1A_EVT_BLK_BIT_OFFSET 0x00
> -#define ACPI_PM1A_CNT_BLK_BIT_WIDTH 0x10
> -#define ACPI_PM1A_CNT_BLK_BIT_OFFSET 0x00
> -#define ACPI_PM_TMR_BLK_BIT_WIDTH 0x20
> -#define ACPI_PM_TMR_BLK_BIT_OFFSET 0x00
> -
> struct acpi_20_fadt Fadt = {
> .header = {
> .signature = ACPI_2_0_FADT_SIGNATURE,
> @@ -56,9 +50,9 @@ struct acpi_20_fadt Fadt = {
> .pm1a_cnt_blk = ACPI_PM1A_CNT_BLK_ADDRESS_V1,
> .pm_tmr_blk = ACPI_PM_TMR_BLK_ADDRESS_V1,
> .gpe0_blk = ACPI_GPE0_BLK_ADDRESS_V1,
> - .pm1_evt_len = ACPI_PM1A_EVT_BLK_BIT_WIDTH / 8,
> - .pm1_cnt_len = ACPI_PM1A_CNT_BLK_BIT_WIDTH / 8,
> - .pm_tmr_len = ACPI_PM_TMR_BLK_BIT_WIDTH / 8,
> + .pm1_evt_len = ACPI_PM1A_EVT_BLK_LEN,
> + .pm1_cnt_len = ACPI_PM1A_CNT_BLK_LEN,
> + .pm_tmr_len = ACPI_PM_TMR_BLK_LEN,
> .gpe0_blk_len = ACPI_GPE0_BLK_LEN_V1,
>
> .p_lvl2_lat = 0x0fff, /* >100, means we do not support C2 state */
> @@ -79,22 +73,22 @@ struct acpi_20_fadt Fadt = {
>
> .x_pm1a_evt_blk = {
> .address_space_id = ACPI_SYSTEM_IO,
> - .register_bit_width = ACPI_PM1A_EVT_BLK_BIT_WIDTH,
> - .register_bit_offset = ACPI_PM1A_EVT_BLK_BIT_OFFSET,
> + .register_bit_width = ACPI_PM1A_EVT_BLK_LEN * 8,
> + .register_bit_offset = ACPI_REG_BIT_OFFSET,
> .address = ACPI_PM1A_EVT_BLK_ADDRESS_V1,
> },
>
> .x_pm1a_cnt_blk = {
> .address_space_id = ACPI_SYSTEM_IO,
> - .register_bit_width = ACPI_PM1A_CNT_BLK_BIT_WIDTH,
> - .register_bit_offset = ACPI_PM1A_CNT_BLK_BIT_OFFSET,
> + .register_bit_width = ACPI_PM1A_CNT_BLK_LEN * 8,
> + .register_bit_offset = ACPI_REG_BIT_OFFSET,
> .address = ACPI_PM1A_CNT_BLK_ADDRESS_V1,
> },
>
> .x_pm_tmr_blk = {
> .address_space_id = ACPI_SYSTEM_IO,
> - .register_bit_width = ACPI_PM_TMR_BLK_BIT_WIDTH,
> - .register_bit_offset = ACPI_PM_TMR_BLK_BIT_OFFSET,
> + .register_bit_width = ACPI_PM_TMR_BLK_LEN * 8,
> + .register_bit_offset = ACPI_REG_BIT_OFFSET,
> .address = ACPI_PM_TMR_BLK_ADDRESS_V1,
> }
> };
> diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-
> x86/hvm/domain.h
> index f34d784..f492a2b 100644
> --- a/xen/include/asm-x86/hvm/domain.h
> +++ b/xen/include/asm-x86/hvm/domain.h
> @@ -87,6 +87,12 @@ struct hvm_domain {
> } ioreq_server;
> struct hvm_ioreq_server *default_ioreq_server;
>
> + /* PVH guests */
> + struct {
> + uint8_t pm1a[ACPI_PM1A_EVT_BLK_LEN];
> + uint8_t gpe[ACPI_GPE0_BLK_LEN_V1];
> + } acpi_io;
> +
> /* Cached CF8 for guest PCI config cycles */
> uint32_t pci_cf8;
>
> diff --git a/xen/include/public/arch-arm.h b/xen/include/public/arch-arm.h
> index bd974fb..b793774 100644
> --- a/xen/include/public/arch-arm.h
> +++ b/xen/include/public/arch-arm.h
> @@ -383,6 +383,9 @@ typedef uint64_t xen_callback_t;
> * should instead use the FDT.
> */
>
> +/* Current supported guest VCPUs */
> +#define GUEST_MAX_VCPUS 128
> +
> /* Physical Address Space */
>
> /*
> @@ -410,6 +413,11 @@ typedef uint64_t xen_callback_t;
> #define GUEST_ACPI_BASE 0x20000000ULL
> #define GUEST_ACPI_SIZE 0x02000000ULL
>
> +/* Location of online VCPU bitmap. */
> +#define ACPI_CPU_MAP 0xaf00
> +#define ACPI_CPU_MAP_LEN ((GUEST_MAX_VCPUS / 8) + \
> + ((GUEST_MAX_VCPUS & 7) ? 1 : 0))
> +
> /*
> * 16MB == 4096 pages reserved for guest to use as a region to map its
> * grant table in.
> @@ -435,9 +443,6 @@ typedef uint64_t xen_callback_t;
> #define GUEST_RAM_BANK_BASES { GUEST_RAM0_BASE,
> GUEST_RAM1_BASE }
> #define GUEST_RAM_BANK_SIZES { GUEST_RAM0_SIZE,
> GUEST_RAM1_SIZE }
>
> -/* Current supported guest VCPUs */
> -#define GUEST_MAX_VCPUS 128
> -
> /* Interrupts */
> #define GUEST_TIMER_VIRT_PPI 27
> #define GUEST_TIMER_PHYS_S_PPI 29
> diff --git a/xen/include/public/hvm/ioreq.h
> b/xen/include/public/hvm/ioreq.h
> index 2e5809b..e3fa704 100644
> --- a/xen/include/public/hvm/ioreq.h
> +++ b/xen/include/public/hvm/ioreq.h
> @@ -24,6 +24,8 @@
> #ifndef _IOREQ_H_
> #define _IOREQ_H_
>
> +#include "hvm_info_table.h" /* HVM_MAX_VCPUS */
> +
> #define IOREQ_READ 1
> #define IOREQ_WRITE 0
>
> @@ -124,6 +126,17 @@ typedef struct buffered_iopage buffered_iopage_t;
> #define ACPI_GPE0_BLK_ADDRESS ACPI_GPE0_BLK_ADDRESS_V0
> #define ACPI_GPE0_BLK_LEN ACPI_GPE0_BLK_LEN_V0
>
> +#define ACPI_PM1A_EVT_BLK_LEN 0x04
> +#define ACPI_PM1A_CNT_BLK_LEN 0x02
> +#define ACPI_PM_TMR_BLK_LEN 0x04
> +
> +/* Location of online VCPU bitmap. */
> +#define ACPI_CPU_MAP 0xaf00
> +#define ACPI_CPU_MAP_LEN ((HVM_MAX_VCPUS / 8) + \
> + ((HVM_MAX_VCPUS & 7) ? 1 : 0))
> +#if ACPI_CPU_MAP + ACPI_CPU_MAP_LEN >=
> ACPI_GPE0_BLK_ADDRESS_V1
> +#error "ACPI_CPU_MAP is too big"
> +#endif
>
> #endif /* _IOREQ_H_ */
>
> --
> 2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-11-09 14:48 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 14:39 [PATCH v2 00/11] PVH VCPU hotplug support Boris Ostrovsky
2016-11-09 14:39 ` [PATCH v2 01/11] x86/domctl: Add XEN_DOMCTL_set_avail_vcpus Boris Ostrovsky
2016-11-09 15:04 ` Andrew Cooper
2016-11-09 15:29 ` Boris Ostrovsky
2016-11-09 19:23 ` Andrew Cooper
2016-11-09 19:47 ` Boris Ostrovsky
2016-11-14 14:59 ` Boris Ostrovsky
2016-11-14 17:17 ` Andrew Cooper
2016-11-14 17:48 ` Boris Ostrovsky
2016-11-14 18:19 ` Andrew Cooper
2016-11-14 18:44 ` Boris Ostrovsky
2016-11-15 16:41 ` Andrew Cooper
2016-11-15 17:04 ` Boris Ostrovsky
2016-11-15 17:30 ` Andrew Cooper
2016-11-15 8:34 ` Jan Beulich
2016-11-15 14:28 ` Boris Ostrovsky
2016-11-15 14:33 ` Jan Beulich
2016-11-15 15:00 ` Boris Ostrovsky
2016-11-09 14:39 ` [PATCH v2 02/11] acpi: Define ACPI IO registers for PVH guests Boris Ostrovsky
2016-11-09 14:48 ` Julien Grall
2016-11-09 14:54 ` Boris Ostrovsky
2016-11-09 14:48 ` Paul Durrant [this message]
2016-11-09 14:59 ` Andrew Cooper
2016-11-09 15:14 ` Boris Ostrovsky
2016-11-09 19:58 ` Andrew Cooper
2016-11-09 21:01 ` Boris Ostrovsky
2016-11-14 15:01 ` Boris Ostrovsky
2016-11-14 17:19 ` Andrew Cooper
2016-11-15 8:47 ` Jan Beulich
2016-11-15 14:47 ` Boris Ostrovsky
2016-11-15 15:13 ` Jan Beulich
2016-11-15 15:41 ` Boris Ostrovsky
2016-11-15 15:53 ` Jan Beulich
2016-11-15 16:23 ` Boris Ostrovsky
2016-11-15 16:33 ` Jan Beulich
2016-11-15 16:58 ` Boris Ostrovsky
2016-11-15 16:59 ` Jan Beulich
2016-11-15 18:31 ` Andrew Cooper
2016-11-09 14:39 ` [PATCH v2 03/11] pvh: Set online VCPU map to avail_vcpus Boris Ostrovsky
2016-11-11 19:57 ` Konrad Rzeszutek Wilk
2016-11-12 15:40 ` Wei Liu
2016-11-09 14:39 ` [PATCH v2 04/11] acpi: Make pmtimer optional in FADT Boris Ostrovsky
2016-11-15 8:49 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 05/11] acpi: Power and Sleep ACPI buttons are not emulated for PVH guests Boris Ostrovsky
2016-11-11 19:56 ` Konrad Rzeszutek Wilk
2016-11-15 8:54 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 06/11] acpi: PVH guests need _E02 method Boris Ostrovsky
2016-11-11 19:58 ` Konrad Rzeszutek Wilk
2016-11-15 8:57 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 07/11] pvh/ioreq: Install handlers for ACPI-related PVH IO accesses Boris Ostrovsky
2016-11-09 14:56 ` Paul Durrant
2016-11-11 20:01 ` Konrad Rzeszutek Wilk
2016-11-15 9:04 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 08/11] pvh/acpi: Handle ACPI accesses for PVH guests Boris Ostrovsky
2016-11-09 14:58 ` Paul Durrant
2016-11-11 20:07 ` Konrad Rzeszutek Wilk
2016-11-15 9:24 ` Jan Beulich
2016-11-15 14:55 ` Boris Ostrovsky
2016-11-15 15:17 ` Jan Beulich
2016-11-15 15:44 ` Boris Ostrovsky
2016-11-15 15:56 ` Jan Beulich
2016-11-15 19:19 ` Andrew Cooper
2016-11-15 19:38 ` Boris Ostrovsky
2016-11-15 20:07 ` Andrew Cooper
2016-11-15 20:20 ` Boris Ostrovsky
2016-11-17 0:00 ` Boris Ostrovsky
2016-11-17 0:08 ` Andrew Cooper
2016-11-16 9:23 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 09/11] events/x86: Define SCI virtual interrupt Boris Ostrovsky
2016-11-15 9:29 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 10/11] pvh: Send an SCI on VCPU hotplug event Boris Ostrovsky
2016-11-15 9:36 ` Jan Beulich
2016-11-15 14:57 ` Boris Ostrovsky
2016-11-15 15:18 ` Jan Beulich
2016-11-15 9:38 ` Jan Beulich
2016-11-09 14:39 ` [PATCH v2 11/11] docs: Describe PVHv2's VCPU hotplug procedure Boris Ostrovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43c7058c6e084e9388b3fff50680c186@AMSPEX02CL03.citrite.net \
--to=paul.durrant@citrix.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).