xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: xen-devel@lists.xen.org
Cc: wei.liu2@citrix.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, jbeulich@suse.com,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	roger.pau@citrix.com
Subject: [PATCH v4 06/15] domctl: Add XEN_DOMCTL_acpi_access
Date: Tue, 29 Nov 2016 10:33:13 -0500	[thread overview]
Message-ID: <1480433602-13290-7-git-send-email-boris.ostrovsky@oracle.com> (raw)
In-Reply-To: <1480433602-13290-1-git-send-email-boris.ostrovsky@oracle.com>

This domctl will allow toolstack to read and write some
ACPI registers. It will be available to both x86 and ARM
but will be implemented first only for x86

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
Changes in v4:
* New patch

 xen/arch/x86/domctl.c            |  9 +++++++++
 xen/arch/x86/hvm/Makefile        |  1 +
 xen/arch/x86/hvm/acpi.c          | 24 ++++++++++++++++++++++++
 xen/include/asm-x86/hvm/domain.h |  3 +++
 xen/include/public/domctl.h      | 25 +++++++++++++++++++++++++
 5 files changed, 62 insertions(+)
 create mode 100644 xen/arch/x86/hvm/acpi.c

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 2a2fe04..111bcbb 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1430,6 +1430,15 @@ long arch_do_domctl(
         }
         break;
 
+    case XEN_DOMCTL_acpi_access:
+        if ( !is_hvm_domain(d) )
+            ret = -EINVAL;
+        else
+            ret = hvm_acpi_domctl_access(d, domctl->u.acpi_access.rw,
+                                         &domctl->u.acpi_access.gas,
+                                         domctl->u.acpi_access.val);
+        break;
+
     default:
         ret = iommu_do_domctl(domctl, d, u_domctl);
         break;
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index f750d13..bae3244 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,6 +1,7 @@
 subdir-y += svm
 subdir-y += vmx
 
+obj-y += acpi.o
 obj-y += asid.o
 obj-y += emulate.o
 obj-y += hpet.o
diff --git a/xen/arch/x86/hvm/acpi.c b/xen/arch/x86/hvm/acpi.c
new file mode 100644
index 0000000..7d42eaf
--- /dev/null
+++ b/xen/arch/x86/hvm/acpi.c
@@ -0,0 +1,24 @@
+/* acpi.c: ACPI access handling
+ *
+ * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ */
+#include <xen/errno.h>
+#include <xen/lib.h>
+#include <xen/sched.h>
+
+
+int hvm_acpi_domctl_access(struct domain *d, uint8_t rw, gas_t *gas,
+                           XEN_GUEST_HANDLE_PARAM(uint8) arg)
+{
+    return -ENOSYS;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/asm-x86/hvm/domain.h b/xen/include/asm-x86/hvm/domain.h
index d55b432..c5cd86c 100644
--- a/xen/include/asm-x86/hvm/domain.h
+++ b/xen/include/asm-x86/hvm/domain.h
@@ -158,6 +158,9 @@ struct hvm_domain {
 
 #define hap_enabled(d)  ((d)->arch.hvm_domain.hap_enabled)
 
+int hvm_acpi_domctl_access(struct domain *currd, uint8_t rw, gas_t *gas,
+                           XEN_GUEST_HANDLE_PARAM(uint8) arg);
+
 #endif /* __ASM_X86_HVM_DOMAIN_H__ */
 
 /*
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 177319d..26fe009 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1144,6 +1144,29 @@ struct xen_domctl_psr_cat_op {
 typedef struct xen_domctl_psr_cat_op xen_domctl_psr_cat_op_t;
 DEFINE_XEN_GUEST_HANDLE(xen_domctl_psr_cat_op_t);
 
+/* ACPI Generic Address Structure */
+typedef struct gas {
+#define XEN_ACPI_SYSTEM_MEMORY 0
+#define XEN_ACPI_SYSTEM_IO     1
+    uint8_t    space_id;           /* Address space */
+    uint8_t    bit_width;          /* Size in bits of given register */
+    uint8_t    bit_offset;         /* Bit offset within the register */
+    uint8_t    access_width;       /* Minimum Access size (ACPI 3.0) */
+    uint64_t   address;            /* 64-bit address of register */
+} gas_t;
+
+struct xen_domctl_acpi_access {
+    gas_t      gas;                    /* IN: Register being accessed */
+
+#define XEN_DOMCTL_ACPI_READ   0
+#define XEN_DOMCTL_ACPI_WRITE  1
+    uint8_t    rw;                     /* IN: Read or write */
+
+    XEN_GUEST_HANDLE_64(uint8) val;    /* IN/OUT: data */
+};
+typedef struct xen_domctl_acpi_access xen_domctl_acpi_access_t;
+DEFINE_XEN_GUEST_HANDLE(xen_domctl_acpi_access_t);
+
 struct xen_domctl {
     uint32_t cmd;
 #define XEN_DOMCTL_createdomain                   1
@@ -1221,6 +1244,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_monitor_op                    77
 #define XEN_DOMCTL_psr_cat_op                    78
 #define XEN_DOMCTL_soft_reset                    79
+#define XEN_DOMCTL_acpi_access                   80
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1283,6 +1307,7 @@ struct xen_domctl {
         struct xen_domctl_psr_cmt_op        psr_cmt_op;
         struct xen_domctl_monitor_op        monitor_op;
         struct xen_domctl_psr_cat_op        psr_cat_op;
+        struct xen_domctl_acpi_access       acpi_access;
         uint8_t                             pad[128];
     } u;
 };
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-11-29 15:33 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-29 15:33 [PATCH v4 00/15] PVH VCPU hotplug support Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 01/15] x86/pmtimer: Move ACPI registers from PMTState to hvm_domain Boris Ostrovsky
2016-12-01 15:52   ` Jan Beulich
2016-12-01 16:28     ` Boris Ostrovsky
2016-12-01 16:29       ` Andrew Cooper
2016-12-01 16:45         ` Boris Ostrovsky
2016-12-12 16:24   ` Wei Liu
2016-11-29 15:33 ` [PATCH v4 02/15] acpi: Make pmtimer optional in FADT Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 03/15] acpi: Power and Sleep ACPI buttons are not emulated for PVH guests Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 04/15] acpi: PVH guests need _E02 method Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 05/15] acpi/x86: Define ACPI IO registers for PVH guests Boris Ostrovsky
2016-12-01 15:57   ` Jan Beulich
2016-12-01 16:30     ` Boris Ostrovsky
2016-11-29 15:33 ` Boris Ostrovsky [this message]
2016-12-01 16:06   ` [PATCH v4 06/15] domctl: Add XEN_DOMCTL_acpi_access Jan Beulich
2016-12-01 16:43     ` Boris Ostrovsky
2016-12-02  7:48       ` Jan Beulich
2016-12-12 13:08         ` Boris Ostrovsky
2016-12-12 14:02           ` Jan Beulich
2016-12-12 16:19             ` Boris Ostrovsky
2016-12-12 16:24               ` Jan Beulich
2016-12-12 13:28   ` Julien Grall
2016-12-12 16:11     ` Boris Ostrovsky
2016-12-13 13:02       ` Julien Grall
2016-11-29 15:33 ` [PATCH v4 07/15] pvh/acpi: Install handlers for ACPI-related PVH IO accesses Boris Ostrovsky
2016-12-01 16:32   ` Jan Beulich
2016-12-01 17:03     ` Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 08/15] pvh/acpi: Handle ACPI accesses for PVH guests Boris Ostrovsky
2016-12-06 14:34   ` Jan Beulich
2016-12-06 16:37     ` Boris Ostrovsky
2016-12-07  8:06       ` Jan Beulich
2016-11-29 15:33 ` [PATCH v4 09/15] x86/domctl: Handle ACPI access from domctl Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 10/15] events/x86: Define SCI virtual interrupt Boris Ostrovsky
2016-12-06 14:36   ` Jan Beulich
2016-11-29 15:33 ` [PATCH v4 11/15] pvh: Send an SCI on VCPU hotplug event Boris Ostrovsky
2016-12-06 14:50   ` Jan Beulich
2016-12-06 16:43     ` Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 12/15] tools: Call XEN_DOMCTL_acpi_access on PVH VCPU hotplug Boris Ostrovsky
2016-12-12 16:35   ` Wei Liu
2016-12-12 16:47     ` Boris Ostrovsky
2016-12-12 16:50       ` Boris Ostrovsky
2016-12-12 17:09         ` Wei Liu
2016-12-12 17:14           ` Boris Ostrovsky
2016-12-12 17:13             ` Wei Liu
2016-11-29 15:33 ` [PATCH v4 13/15] pvh: Set online VCPU map to avail_vcpus Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 14/15] pvh/acpi: Save ACPI registers for PVH guests Boris Ostrovsky
2016-11-29 15:33 ` [PATCH v4 15/15] docs: Describe PVHv2's VCPU hotplug procedure Boris Ostrovsky
2016-12-06 20:55   ` Konrad Rzeszutek Wilk
2016-11-29 16:11 ` [PATCH v4 00/15] PVH VCPU hotplug support Jan Beulich
2016-11-29 16:40   ` Boris Ostrovsky
2016-11-29 16:43     ` Jan Beulich
2016-11-29 17:00       ` 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=1480433602-13290-7-git-send-email-boris.ostrovsky@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.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).