Message ID | 1396262773-7723-3-git-send-email-anup.patel@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Mon, Mar 31, 2014 at 04:16:03PM +0530, Anup Patel wrote: > We need a common place to share PSCI related defines among ARM kernel, > ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. > > We introduce uapi/linux/psci.h for this purpose. This newly added > header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation > and user space (i.e. QEMU or KVMTOOL). > > Signed-off-by: Anup Patel <anup.patel@linaro.org> > Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> > --- > include/uapi/linux/Kbuild | 1 + > include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+) > create mode 100644 include/uapi/linux/psci.h > You should coordinate with Ashwin's work so you don't step on each other's definitions and one patch set should depend on the other one. -Christoffer
Hello, On 31 March 2014 14:07, Christoffer Dall <christoffer.dall@linaro.org> wrote: > On Mon, Mar 31, 2014 at 04:16:03PM +0530, Anup Patel wrote: >> We need a common place to share PSCI related defines among ARM kernel, >> ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. >> >> We introduce uapi/linux/psci.h for this purpose. This newly added >> header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation >> and user space (i.e. QEMU or KVMTOOL). >> >> Signed-off-by: Anup Patel <anup.patel@linaro.org> >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >> --- >> include/uapi/linux/Kbuild | 1 + >> include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 56 insertions(+) >> create mode 100644 include/uapi/linux/psci.h >> > > You should coordinate with Ashwin's work so you don't step on each > other's definitions and one patch set should depend on the other one. So, apart from some extra #defines we mostly differ on style. Whats the general recommendation here? Mine looks simpler [1] ;) Cheers, Ashwin [1] http://www.spinics.net/lists/arm-kernel/msg319090.html
On Mon, Mar 31, 2014 at 02:18:20PM -0400, Ashwin Chaugule wrote: > Hello, > > On 31 March 2014 14:07, Christoffer Dall <christoffer.dall@linaro.org> wrote: > > On Mon, Mar 31, 2014 at 04:16:03PM +0530, Anup Patel wrote: > >> We need a common place to share PSCI related defines among ARM kernel, > >> ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. > >> > >> We introduce uapi/linux/psci.h for this purpose. This newly added > >> header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation > >> and user space (i.e. QEMU or KVMTOOL). > >> > >> Signed-off-by: Anup Patel <anup.patel@linaro.org> > >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> > >> --- > >> include/uapi/linux/Kbuild | 1 + > >> include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ > >> 2 files changed, 56 insertions(+) > >> create mode 100644 include/uapi/linux/psci.h > >> > > > > You should coordinate with Ashwin's work so you don't step on each > > other's definitions and one patch set should depend on the other one. > > So, apart from some extra #defines we mostly differ on style. Whats > the general recommendation here? > Mine looks simpler [1] ;) > I think Marc brought up the point previously that we may get to PSCI spec v42.17 and the defines should perhaps encompass the version we are defining things for right now... That being said, assuming new spec versions don't break backwards compatibility in the numbering, the wording proposed by your patch does look simpler. I do like the hardcoded IDs because that's how it's presented in the spec itself. -Christoffer
Hi Christoffer, On 31 March 2014 14:36, Christoffer Dall <christoffer.dall@linaro.org> wrote: >> > I think Marc brought up the point previously that we may get to PSCI > spec v42.17 and the defines should perhaps encompass the version we are > defining things for right now... > > That being said, assuming new spec versions don't break backwards > compatibility in the numbering, the wording proposed by your patch does > look simpler. > > I do like the hardcoded IDs because that's how it's presented in the > spec itself. Cool. I'll just add the following line in kbuild to this patch and resend. include/uapi/linux/Kbuild | 1 + +header-y += psci.h Meanwhile, if there are any strong preferences to using the uapi header in Anup's patch, then I can rebase later. Thanks, Ashwin
On 31 March 2014 15:26, Ashwin Chaugule <ashwin.chaugule@linaro.org> wrote: > Hi Christoffer, > > On 31 March 2014 14:36, Christoffer Dall <christoffer.dall@linaro.org> wrote: > >>> >> I think Marc brought up the point previously that we may get to PSCI >> spec v42.17 and the defines should perhaps encompass the version we are >> defining things for right now... >> >> That being said, assuming new spec versions don't break backwards >> compatibility in the numbering, the wording proposed by your patch does >> look simpler. >> >> I do like the hardcoded IDs because that's how it's presented in the >> spec itself. > > Cool. I'll just add the following line in kbuild to this patch and resend. by "this" patch, I meant my version. Sorry if I caused any confusion. :) > > include/uapi/linux/Kbuild | 1 + > > +header-y += psci.h > > Meanwhile, if there are any strong preferences to using the uapi > header in Anup's patch, then I can rebase later. > > Thanks, > Ashwin
Hi Ashwin, On Tue, Apr 1, 2014 at 1:13 AM, Ashwin Chaugule <ashwin.chaugule@linaro.org> wrote: > On 31 March 2014 15:26, Ashwin Chaugule <ashwin.chaugule@linaro.org> wrote: >> Hi Christoffer, >> >> On 31 March 2014 14:36, Christoffer Dall <christoffer.dall@linaro.org> wrote: >> >>>> >>> I think Marc brought up the point previously that we may get to PSCI >>> spec v42.17 and the defines should perhaps encompass the version we are >>> defining things for right now... >>> >>> That being said, assuming new spec versions don't break backwards >>> compatibility in the numbering, the wording proposed by your patch does >>> look simpler. >>> >>> I do like the hardcoded IDs because that's how it's presented in the >>> spec itself. >> >> Cool. I'll just add the following line in kbuild to this patch and resend. > > by "this" patch, I meant my version. Sorry if I caused any confusion. :) > >> >> include/uapi/linux/Kbuild | 1 + >> >> +header-y += psci.h >> >> Meanwhile, if there are any strong preferences to using the uapi >> header in Anup's patch, then I can rebase later. Yes, the only difference between headers introduced by your patch and this patch would be styling. I was thinking of quickly revising this patch with following changes pickedup from your patch: +#define PSCI_POWER_STATE_ID_MASK 0xffff +#define PSCI_POWER_STATE_ID_SHIFT 0 +#define PSCI_POWER_STATE_TYPE_MASK 0x1 +#define PSCI_POWER_STATE_TYPE_SHIFT 16 +#define PSCI_POWER_STATE_AFFL_MASK 0x3 +#define PSCI_POWER_STATE_AFFL_SHIFT 24 + +#define PSCI_VER_MAJOR_MASK 0xffff0000 +#define PSCI_VER_MINOR_MASK 0x0000ffff +#define PSCI_VER_MAJOR_SHIFT 16 +#define PSCI_VER_MAJOR(ver) \ + ((ver & PSCI_VER_MAJOR_MASK) >> PSCI_VER_MAJOR_SHIFT) +#define PSCI_VER_MINOR(ver) (ver & PSCI_VER_MINOR_MASK) We also have another RFC v2 patchset for QEMU side changes (being tested currently) which uses the PSCI defines introduced by this patch. It would be very helpful if you could rebase your patch with v7 of this patch which will include some changes from your patch. (Does this sound OK to you?) Regards, Anup >> >> Thanks, >> Ashwin > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
On Mon, Mar 31, 2014 at 5:46 AM, Anup Patel <anup.patel@linaro.org> wrote: > We need a common place to share PSCI related defines among ARM kernel, > ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. > > We introduce uapi/linux/psci.h for this purpose. This newly added > header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation > and user space (i.e. QEMU or KVMTOOL). > > Signed-off-by: Anup Patel <anup.patel@linaro.org> > Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> > --- > include/uapi/linux/Kbuild | 1 + > include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 56 insertions(+) > create mode 100644 include/uapi/linux/psci.h > > diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild > index 6929571..24e9033 100644 > --- a/include/uapi/linux/Kbuild > +++ b/include/uapi/linux/Kbuild > @@ -317,6 +317,7 @@ header-y += ppp-ioctl.h > header-y += ppp_defs.h > header-y += pps.h > header-y += prctl.h > +header-y += psci.h > header-y += ptp_clock.h > header-y += ptrace.h > header-y += qnx4_fs.h > diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h > new file mode 100644 > index 0000000..41f727e > --- /dev/null > +++ b/include/uapi/linux/psci.h > @@ -0,0 +1,55 @@ > +/* > + * ARM Power State and Coordination Interface (PSCI) header > + * > + * This header holds common PSCI defines and macros shared by: > + * ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. > + * > + * Copyright (C) 2014 Anup Patel <anup.patel@linaro.org> Like I told Ashwin, fix the copyright. You can be the author, but Linaro is the copyright holder. > + */ > + > +#ifndef _UAPI_LINUX_PSCI_H > +#define _UAPI_LINUX_PSCI_H > + > +/* PSCI v0.1 interface */ > +#define PSCI_FN(base, n) ((base) + (n)) > + > +#define PSCI_FN_CPU_SUSPEND(base) PSCI_FN(base, 0) > +#define PSCI_FN_CPU_OFF(base) PSCI_FN(base, 1) > +#define PSCI_FN_CPU_ON(base) PSCI_FN(base, 2) > +#define PSCI_FN_MIGRATE(base) PSCI_FN(base, 3) > + > +/* PSCI v0.2 interface */ > +#define PSCI_0_2_FN_BASE 0x84000000 > +#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) > +#define PSCI_0_2_FN64_BASE 0xC4000000 > +#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) This could be something like: #define PSCI_0_2_64BIT 0x40000000 #define PSCI_0_2_FN64(n) (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT + (n)) It's also useful as you may want to be able to check for 64-bit calls. > + > +#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) > +#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) > +#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) > +#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) > +#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) > +#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) > +#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) > +#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) > +#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) > +#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) > + > +#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) > +#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) > +#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) > +#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) > +#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) > + > +/* PSCI return values */ > +#define PSCI_RET_SUCCESS 0 > +#define PSCI_RET_NOT_SUPPORTED ((unsigned long)-1) > +#define PSCI_RET_INVALID_PARAMS ((unsigned long)-2) > +#define PSCI_RET_DENIED ((unsigned long)-3) > +#define PSCI_RET_ALREADY_ON ((unsigned long)-4) > +#define PSCI_RET_ON_PENDING ((unsigned long)-5) > +#define PSCI_RET_INTERNAL_FAILURE ((unsigned long)-6) > +#define PSCI_RET_NOT_PRESENT ((unsigned long)-7) > +#define PSCI_RET_DISABLED ((unsigned long)-8) These should not be cast. The return values are defined to be int32 independent of 64-bit or 32-bit calls. Rob
On Wed, Apr 2, 2014 at 9:52 AM, Rob Herring <rob.herring@linaro.org> wrote: > On Mon, Mar 31, 2014 at 5:46 AM, Anup Patel <anup.patel@linaro.org> wrote: >> We need a common place to share PSCI related defines among ARM kernel, >> ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. >> >> We introduce uapi/linux/psci.h for this purpose. This newly added >> header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation >> and user space (i.e. QEMU or KVMTOOL). >> >> Signed-off-by: Anup Patel <anup.patel@linaro.org> >> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >> --- >> include/uapi/linux/Kbuild | 1 + >> include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 56 insertions(+) >> create mode 100644 include/uapi/linux/psci.h >> >> diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild >> index 6929571..24e9033 100644 >> --- a/include/uapi/linux/Kbuild >> +++ b/include/uapi/linux/Kbuild >> @@ -317,6 +317,7 @@ header-y += ppp-ioctl.h >> header-y += ppp_defs.h >> header-y += pps.h >> header-y += prctl.h >> +header-y += psci.h >> header-y += ptp_clock.h >> header-y += ptrace.h >> header-y += qnx4_fs.h >> diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h >> new file mode 100644 >> index 0000000..41f727e >> --- /dev/null >> +++ b/include/uapi/linux/psci.h >> @@ -0,0 +1,55 @@ >> +/* >> + * ARM Power State and Coordination Interface (PSCI) header >> + * >> + * This header holds common PSCI defines and macros shared by: >> + * ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. >> + * >> + * Copyright (C) 2014 Anup Patel <anup.patel@linaro.org> > > Like I told Ashwin, fix the copyright. You can be the author, but > Linaro is the copyright holder. Sure, I will update the copyright as-per your suggestion. > >> + */ >> + >> +#ifndef _UAPI_LINUX_PSCI_H >> +#define _UAPI_LINUX_PSCI_H >> + >> +/* PSCI v0.1 interface */ >> +#define PSCI_FN(base, n) ((base) + (n)) >> + >> +#define PSCI_FN_CPU_SUSPEND(base) PSCI_FN(base, 0) >> +#define PSCI_FN_CPU_OFF(base) PSCI_FN(base, 1) >> +#define PSCI_FN_CPU_ON(base) PSCI_FN(base, 2) >> +#define PSCI_FN_MIGRATE(base) PSCI_FN(base, 3) >> + >> +/* PSCI v0.2 interface */ >> +#define PSCI_0_2_FN_BASE 0x84000000 >> +#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) >> +#define PSCI_0_2_FN64_BASE 0xC4000000 >> +#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) > > This could be something like: > > #define PSCI_0_2_64BIT 0x40000000 > #define PSCI_0_2_FN64(n) (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT + (n)) > > It's also useful as you may want to be able to check for 64-bit calls. Good point. From PSCI emulation perspective, I did not face this situation but we might need this in future. > >> + >> +#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) >> +#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) >> +#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) >> +#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) >> +#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) >> +#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) >> +#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) >> +#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) >> +#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) >> +#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) >> + >> +#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) >> +#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) >> +#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) >> +#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) >> +#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) >> + >> +/* PSCI return values */ >> +#define PSCI_RET_SUCCESS 0 >> +#define PSCI_RET_NOT_SUPPORTED ((unsigned long)-1) >> +#define PSCI_RET_INVALID_PARAMS ((unsigned long)-2) >> +#define PSCI_RET_DENIED ((unsigned long)-3) >> +#define PSCI_RET_ALREADY_ON ((unsigned long)-4) >> +#define PSCI_RET_ON_PENDING ((unsigned long)-5) >> +#define PSCI_RET_INTERNAL_FAILURE ((unsigned long)-6) >> +#define PSCI_RET_NOT_PRESENT ((unsigned long)-7) >> +#define PSCI_RET_DISABLED ((unsigned long)-8) > > These should not be cast. The return values are defined to be int32 > independent of 64-bit or 32-bit calls. The cast is for ease of use in kernel and emulation code. With the cast in place, we can assign PSCI return values to signed as well as unsigned variables. > > Rob > _______________________________________________ > kvmarm mailing list > kvmarm@lists.cs.columbia.edu > https://lists.cs.columbia.edu/mailman/listinfo/kvmarm -- Anup
On Wed, Apr 2, 2014 at 10:01 AM, Anup Patel <anup@brainfault.org> wrote: > On Wed, Apr 2, 2014 at 9:52 AM, Rob Herring <rob.herring@linaro.org> wrote: >> On Mon, Mar 31, 2014 at 5:46 AM, Anup Patel <anup.patel@linaro.org> wrote: >>> We need a common place to share PSCI related defines among ARM kernel, >>> ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. >>> >>> We introduce uapi/linux/psci.h for this purpose. This newly added >>> header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation >>> and user space (i.e. QEMU or KVMTOOL). >>> >>> Signed-off-by: Anup Patel <anup.patel@linaro.org> >>> Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org> >>> --- >>> include/uapi/linux/Kbuild | 1 + >>> include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ >>> 2 files changed, 56 insertions(+) >>> create mode 100644 include/uapi/linux/psci.h >>> >>> diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild >>> index 6929571..24e9033 100644 >>> --- a/include/uapi/linux/Kbuild >>> +++ b/include/uapi/linux/Kbuild >>> @@ -317,6 +317,7 @@ header-y += ppp-ioctl.h >>> header-y += ppp_defs.h >>> header-y += pps.h >>> header-y += prctl.h >>> +header-y += psci.h >>> header-y += ptp_clock.h >>> header-y += ptrace.h >>> header-y += qnx4_fs.h >>> diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h >>> new file mode 100644 >>> index 0000000..41f727e >>> --- /dev/null >>> +++ b/include/uapi/linux/psci.h >>> @@ -0,0 +1,55 @@ >>> +/* >>> + * ARM Power State and Coordination Interface (PSCI) header >>> + * >>> + * This header holds common PSCI defines and macros shared by: >>> + * ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. >>> + * >>> + * Copyright (C) 2014 Anup Patel <anup.patel@linaro.org> >> >> Like I told Ashwin, fix the copyright. You can be the author, but >> Linaro is the copyright holder. > > Sure, I will update the copyright as-per your suggestion. > >> >>> + */ >>> + >>> +#ifndef _UAPI_LINUX_PSCI_H >>> +#define _UAPI_LINUX_PSCI_H >>> + >>> +/* PSCI v0.1 interface */ >>> +#define PSCI_FN(base, n) ((base) + (n)) >>> + >>> +#define PSCI_FN_CPU_SUSPEND(base) PSCI_FN(base, 0) >>> +#define PSCI_FN_CPU_OFF(base) PSCI_FN(base, 1) >>> +#define PSCI_FN_CPU_ON(base) PSCI_FN(base, 2) >>> +#define PSCI_FN_MIGRATE(base) PSCI_FN(base, 3) >>> + >>> +/* PSCI v0.2 interface */ >>> +#define PSCI_0_2_FN_BASE 0x84000000 >>> +#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) >>> +#define PSCI_0_2_FN64_BASE 0xC4000000 >>> +#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) >> >> This could be something like: >> >> #define PSCI_0_2_64BIT 0x40000000 >> #define PSCI_0_2_FN64(n) (PSCI_0_2_FN_BASE + PSCI_0_2_64BIT + (n)) >> >> It's also useful as you may want to be able to check for 64-bit calls. > > Good point. > > From PSCI emulation perspective, I did not face this situation but we might > need this in future. > >> >>> + >>> +#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) >>> +#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) >>> +#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) >>> +#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) >>> +#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) >>> +#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) >>> +#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) >>> +#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) >>> +#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) >>> +#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) >>> + >>> +#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) >>> +#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) >>> +#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) >>> +#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) >>> +#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) >>> + >>> +/* PSCI return values */ >>> +#define PSCI_RET_SUCCESS 0 >>> +#define PSCI_RET_NOT_SUPPORTED ((unsigned long)-1) >>> +#define PSCI_RET_INVALID_PARAMS ((unsigned long)-2) >>> +#define PSCI_RET_DENIED ((unsigned long)-3) >>> +#define PSCI_RET_ALREADY_ON ((unsigned long)-4) >>> +#define PSCI_RET_ON_PENDING ((unsigned long)-5) >>> +#define PSCI_RET_INTERNAL_FAILURE ((unsigned long)-6) >>> +#define PSCI_RET_NOT_PRESENT ((unsigned long)-7) >>> +#define PSCI_RET_DISABLED ((unsigned long)-8) >> >> These should not be cast. The return values are defined to be int32 >> independent of 64-bit or 32-bit calls. > > The cast is for ease of use in kernel and emulation code. > > With the cast in place, we can assign PSCI return values to signed > as well as unsigned variables. Never mind, I will update in-kernel PSCI emulation to do the typecasting wherever required. This way we can keep this header closer to spec. > >> >> Rob >> _______________________________________________ >> kvmarm mailing list >> kvmarm@lists.cs.columbia.edu >> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm > > -- > Anup -- Anup
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 6929571..24e9033 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -317,6 +317,7 @@ header-y += ppp-ioctl.h header-y += ppp_defs.h header-y += pps.h header-y += prctl.h +header-y += psci.h header-y += ptp_clock.h header-y += ptrace.h header-y += qnx4_fs.h diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h new file mode 100644 index 0000000..41f727e --- /dev/null +++ b/include/uapi/linux/psci.h @@ -0,0 +1,55 @@ +/* + * ARM Power State and Coordination Interface (PSCI) header + * + * This header holds common PSCI defines and macros shared by: + * ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. + * + * Copyright (C) 2014 Anup Patel <anup.patel@linaro.org> + */ + +#ifndef _UAPI_LINUX_PSCI_H +#define _UAPI_LINUX_PSCI_H + +/* PSCI v0.1 interface */ +#define PSCI_FN(base, n) ((base) + (n)) + +#define PSCI_FN_CPU_SUSPEND(base) PSCI_FN(base, 0) +#define PSCI_FN_CPU_OFF(base) PSCI_FN(base, 1) +#define PSCI_FN_CPU_ON(base) PSCI_FN(base, 2) +#define PSCI_FN_MIGRATE(base) PSCI_FN(base, 3) + +/* PSCI v0.2 interface */ +#define PSCI_0_2_FN_BASE 0x84000000 +#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) +#define PSCI_0_2_FN64_BASE 0xC4000000 +#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) + +#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) +#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) +#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) +#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) +#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) +#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) +#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) +#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) +#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) +#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) + +#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) +#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) +#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) +#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) +#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) + +/* PSCI return values */ +#define PSCI_RET_SUCCESS 0 +#define PSCI_RET_NOT_SUPPORTED ((unsigned long)-1) +#define PSCI_RET_INVALID_PARAMS ((unsigned long)-2) +#define PSCI_RET_DENIED ((unsigned long)-3) +#define PSCI_RET_ALREADY_ON ((unsigned long)-4) +#define PSCI_RET_ON_PENDING ((unsigned long)-5) +#define PSCI_RET_INTERNAL_FAILURE ((unsigned long)-6) +#define PSCI_RET_NOT_PRESENT ((unsigned long)-7) +#define PSCI_RET_DISABLED ((unsigned long)-8) + +#endif /* _UAPI_LINUX_PSCI_H */