Message ID | 1485796915-9372-6-git-send-email-edgar.iglesias@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Jan 30, 2017 at 06:21:54PM +0100, Edgar E. Iglesias wrote: > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Forward platform specific firmware calls from the hardware > domain to firmware. > > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> > --- > xen/arch/arm/platforms/xilinx-zynqmp.c | 63 ++++++++++++++++++++++++++++++++++ > 1 file changed, 63 insertions(+) > > diff --git a/xen/arch/arm/platforms/xilinx-zynqmp.c b/xen/arch/arm/platforms/xilinx-zynqmp.c > index 2adee91..bde7f52 100644 > --- a/xen/arch/arm/platforms/xilinx-zynqmp.c > +++ b/xen/arch/arm/platforms/xilinx-zynqmp.c > @@ -19,6 +19,46 @@ > > #include <asm/platform.h> > > +/* Service calls. */ > +#define SVC_MASK 0x3F000000 > +#define SVC_SIP 0x02000000 /* SoC Implementation Specific. */ > + > +/* SMC function IDs for SiP Service queries */ > +#define ZYNQMP_SIP_SVC_CALL_COUNT 0xff00 > +#define ZYNQMP_SIP_SVC_UID 0xff01 > +#define ZYNQMP_SIP_SVC_VERSION 0xff03 > + > +enum pm_api_id { > + /* Miscellaneous API functions: */ > + GET_API_VERSION = 1, > + SET_CONFIGURATION, These pm_api_id enums are a left over and not needed, I'll remove them from future versions of this patch. Cheers, Edgar > + GET_NODE_STATUS, > + GET_OPERATING_CHARACTERISTIC, > + REGISTER_NOTIFIER, > + /* API for suspending of PUs: */ > + REQUEST_SUSPEND, > + SELF_SUSPEND, > + FORCE_POWERDOWN, > + ABORT_SUSPEND, > + REQUEST_WAKEUP, > + SET_WAKEUP_SOURCE, > + SYSTEM_SHUTDOWN, > + /* API for managing PM slaves: */ > + REQUEST_NODE, > + RELEASE_NODE, > + SET_REQUIREMENT, > + SET_MAX_LATENCY, > + /* Direct control API functions: */ > + RESET_ASSERT, > + RESET_GET_STATUS, > + MMIO_WRITE, > + MMIO_READ, > + PM_INIT, > + FPGA_LOAD, > + FPGA_GET_STATUS, > + GET_CHIPID, > +}; > + > static const char * const zynqmp_dt_compat[] __initconst = > { > "xlnx,zynqmp", > @@ -32,8 +72,31 @@ static const struct dt_device_match zynqmp_blacklist_dev[] __initconst = > { /* sentinel */ }, > }; > > +bool zynqmp_hvc(struct cpu_user_regs *regs) > +{ > + uint32_t fid = regs->x0; > + uint32_t svc = fid & SVC_MASK; > + register_t ret[4]; > + > + /* We only forward SiP service calls from the hw domain to firmware. */ > + if ( svc != SVC_SIP || !is_hardware_domain(current->domain) ) > + return false; > + > + /* Forward the call. */ > + call_smcc64(regs->x0, regs->x1, regs->x2, regs->x3, > + regs->x4, regs->x5, regs->x6, ret); > + > + /* Transfer return values into guest registers. */ > + regs->x0 = ret[0]; > + regs->x1 = ret[1]; > + regs->x2 = ret[2]; > + regs->x3 = ret[3]; > + return true; > +} > + > PLATFORM_START(xgene_storm, "Xilinx ZynqMP") > .compatible = zynqmp_dt_compat, > + .hvc = zynqmp_hvc, > .blacklist_dev = zynqmp_blacklist_dev, > PLATFORM_END > > -- > 2.7.4 >
diff --git a/xen/arch/arm/platforms/xilinx-zynqmp.c b/xen/arch/arm/platforms/xilinx-zynqmp.c index 2adee91..bde7f52 100644 --- a/xen/arch/arm/platforms/xilinx-zynqmp.c +++ b/xen/arch/arm/platforms/xilinx-zynqmp.c @@ -19,6 +19,46 @@ #include <asm/platform.h> +/* Service calls. */ +#define SVC_MASK 0x3F000000 +#define SVC_SIP 0x02000000 /* SoC Implementation Specific. */ + +/* SMC function IDs for SiP Service queries */ +#define ZYNQMP_SIP_SVC_CALL_COUNT 0xff00 +#define ZYNQMP_SIP_SVC_UID 0xff01 +#define ZYNQMP_SIP_SVC_VERSION 0xff03 + +enum pm_api_id { + /* Miscellaneous API functions: */ + GET_API_VERSION = 1, + SET_CONFIGURATION, + GET_NODE_STATUS, + GET_OPERATING_CHARACTERISTIC, + REGISTER_NOTIFIER, + /* API for suspending of PUs: */ + REQUEST_SUSPEND, + SELF_SUSPEND, + FORCE_POWERDOWN, + ABORT_SUSPEND, + REQUEST_WAKEUP, + SET_WAKEUP_SOURCE, + SYSTEM_SHUTDOWN, + /* API for managing PM slaves: */ + REQUEST_NODE, + RELEASE_NODE, + SET_REQUIREMENT, + SET_MAX_LATENCY, + /* Direct control API functions: */ + RESET_ASSERT, + RESET_GET_STATUS, + MMIO_WRITE, + MMIO_READ, + PM_INIT, + FPGA_LOAD, + FPGA_GET_STATUS, + GET_CHIPID, +}; + static const char * const zynqmp_dt_compat[] __initconst = { "xlnx,zynqmp", @@ -32,8 +72,31 @@ static const struct dt_device_match zynqmp_blacklist_dev[] __initconst = { /* sentinel */ }, }; +bool zynqmp_hvc(struct cpu_user_regs *regs) +{ + uint32_t fid = regs->x0; + uint32_t svc = fid & SVC_MASK; + register_t ret[4]; + + /* We only forward SiP service calls from the hw domain to firmware. */ + if ( svc != SVC_SIP || !is_hardware_domain(current->domain) ) + return false; + + /* Forward the call. */ + call_smcc64(regs->x0, regs->x1, regs->x2, regs->x3, + regs->x4, regs->x5, regs->x6, ret); + + /* Transfer return values into guest registers. */ + regs->x0 = ret[0]; + regs->x1 = ret[1]; + regs->x2 = ret[2]; + regs->x3 = ret[3]; + return true; +} + PLATFORM_START(xgene_storm, "Xilinx ZynqMP") .compatible = zynqmp_dt_compat, + .hvc = zynqmp_hvc, .blacklist_dev = zynqmp_blacklist_dev, PLATFORM_END