All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Kai" <kai.huang@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>, Kai Huang <kaih.linux@gmail.com>
Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 15/15] xen: tools: expose EPC in ACPI table
Date: Mon, 17 Jul 2017 18:11:58 +1200	[thread overview]
Message-ID: <10dc0bd3-d87d-1706-8d0b-9300d07fb607@linux.intel.com> (raw)
In-Reply-To: <5968C7C1020000780016AAEE@prv-mh.provo.novell.com>



On 7/14/2017 11:31 PM, Jan Beulich wrote:
>>>> On 09.07.17 at 10:16, <kaih.linux@gmail.com> wrote:
>> --- a/tools/firmware/hvmloader/util.c
>> +++ b/tools/firmware/hvmloader/util.c
>> @@ -330,6 +330,15 @@ cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
>>           : "0" (idx) );
>>   }
>>   
>> +void cpuid_count(uint32_t idx, uint32_t count, uint32_t *eax,
> 
> Please name the first two leaf and subleaf.

Sure will do.

> 
>> @@ -888,6 +897,18 @@ static uint8_t acpi_lapic_id(unsigned cpu)
>>       return LAPIC_ID(cpu);
>>   }
>>   
>> +static void get_epc_info(struct acpi_config *config)
>> +{
>> +    uint32_t eax, ebx, ecx, edx;
>> +
>> +    cpuid_count(0x12, 0x2, &eax, &ebx, &ecx, &edx);
>> +
>> +    config->epc_base = (((uint64_t)(ebx & 0xfffff)) << 32) |
>> +                       (uint64_t)(eax & 0xfffff000);
> 
> Pointless cast.
> 
>> +    config->epc_size = (((uint64_t)(edx & 0xfffff)) << 32) |
>> +                       (uint64_t)(ecx & 0xfffff000);
> 
> Again.

Will do.

> 
>> --- a/tools/libacpi/dsdt.asl
>> +++ b/tools/libacpi/dsdt.asl
>> @@ -441,6 +441,55 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
>>                   }
>>               }
>>           }
>> +
>> +        Device (EPC)
>> +        {
>> +            Name (_HID, EisaId ("INT0E0C"))
>> +            Name (_STR, Unicode ("Enclave Page Cache 1.5"))
>> +            Name (_MLS, Package (0x01)
>> +            {
>> +                Package (0x02)
>> +                {
>> +                    "en",
>> +                    Unicode ("Enclave Page Cache 1.5")
>> +                }
>> +            })
>> +            Name (RBUF, ResourceTemplate ()
>> +            {
>> +                QWordMemory (ResourceConsumer, PosDecode, MinFixed, MaxFixed,
>> +                    Cacheable, ReadWrite,
>> +                    0x0000000000000000, // Granularity
>> +                    0x0000000000000000, // Range Minimum
>> +                    0x0000000000000000, // Range Maximum
>> +                    0x0000000000000000, // Translation Offset
>> +                    0x0000000000000001, // Length
>> +                    ,, _Y03,
>> +                    AddressRangeMemory, TypeStatic)
>> +            })
>> +
>> +            Method(_CRS, 0, NotSerialized) // _CRS: Current Resource Settings
>> +            {
>> +                CreateQwordField (RBUF, \_SB.EPC._Y03._MIN, EMIN) // _MIN: Minimuum Base Address
>> +                CreateQwordField (RBUF, \_SB.EPC._Y03._MAX, EMAX) // _MIN: Maximum Base Address
>> +                CreateQwordField (RBUF, \_SB.EPC._Y03._LEN, ELEN) // _LEN: Length
> 
> Please see the comment in _SB.PCI0._CRS regarding operations
> on qword fields. Even if we may not formally support the named
> Windows versions anymore, we should continue to be careful
> here. You could have noticed this by seeing that ...
> 
>> @@ -21,6 +21,8 @@
>>              LMIN, 32,
>>              HMIN, 32,
>>              LLEN, 32,
>> -           HLEN, 32
>> +           HLEN, 32,
>> +           EMIN, 64,
>> +           ELEN, 64,
>>          }
> 
> ... there have been no 64-bit fields here so far.

Thank you for pointing this out. I'll take a look.

> 
>> @@ -156,6 +156,9 @@ static int init_acpi_config(libxl__gc *gc,
>>       config->lapic_id = acpi_lapic_id;
>>       config->acpi_revision = 5;
>>   
>> +    config->epc_base = b_info->u.hvm.sgx.epcbase;
>> +    config->epc_size = (b_info->u.hvm.sgx.epckb << 10);
> 
> Pointless parentheses. Plus I guess the field names could do with
> an underscore separator in the middle - it took me a moment to
> realize this is a kB value (explaining the shift by 10).

Sure. will change to epc_kb and epc_base :)

Thanks,
-Kai
> 
> Jan
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
> 

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

  reply	other threads:[~2017-07-17  6:11 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-09  8:03 [RFC PATCH 00/15] RFC: SGX virtualization design and draft patches Kai Huang
2017-07-09  8:04 ` [PATCH 01/15] xen: x86: expose SGX to HVM domain in CPU featureset Kai Huang
2017-07-12 11:09   ` Andrew Cooper
2017-07-17  6:20     ` Huang, Kai
2017-07-18 10:12   ` Andrew Cooper
2017-07-18 22:41     ` Huang, Kai
2017-07-09  8:09 ` [PATCH 02/15] xen: vmx: detect ENCLS VMEXIT Kai Huang
2017-07-12 11:11   ` Andrew Cooper
2017-07-12 18:54     ` Jan Beulich
2017-07-13  4:57       ` Huang, Kai
2017-07-09  8:09 ` [PATCH 03/15] xen: x86: add early stage SGX feature detection Kai Huang
2017-07-19 14:23   ` Andrew Cooper
2017-07-21  9:17     ` Huang, Kai
2017-07-22  1:06       ` Huang, Kai
2017-07-09  8:09 ` [PATCH 06/15] xen: x86: add SGX basic EPC management Kai Huang
2017-07-09  8:09 ` [PATCH 07/15] xen: x86: add functions to populate and destroy EPC for domain Kai Huang
2017-07-09  8:09 ` [PATCH 09/15] xen: vmx: handle SGX related MSRs Kai Huang
2017-07-19 17:27   ` Andrew Cooper
2017-07-21  9:42     ` Huang, Kai
2017-07-22  1:37       ` Huang, Kai
2017-07-09  8:09 ` [PATCH 10/15] xen: vmx: handle ENCLS VMEXIT Kai Huang
2017-07-09  8:09 ` [PATCH 11/15] xen: vmx: handle VMEXIT from SGX enclave Kai Huang
2017-07-09  8:09 ` [PATCH 12/15] xen: x86: reset EPC when guest got suspended Kai Huang
2017-07-09  8:10 ` [PATCH 04/15] xen: mm: add ioremap_cache Kai Huang
2017-07-11 20:14   ` Julien Grall
2017-07-12  1:52     ` Huang, Kai
2017-07-12  7:13       ` Julien Grall
2017-07-13  5:01         ` Huang, Kai
2017-07-12  6:17     ` Jan Beulich
2017-07-13  4:59       ` Huang, Kai
2017-07-09  8:10 ` [PATCH 08/15] xen: x86: add SGX cpuid handling support Kai Huang
2017-07-12 10:56   ` Andrew Cooper
2017-07-13  5:42     ` Huang, Kai
2017-07-14  7:37       ` Andrew Cooper
2017-07-14 11:08         ` Jan Beulich
2017-07-17  6:16         ` Huang, Kai
2017-07-09  8:12 ` [PATCH 05/15] xen: p2m: new 'p2m_epc' type for EPC mapping Kai Huang
2017-07-12 11:01   ` Andrew Cooper
2017-07-12 12:21     ` George Dunlap
2017-07-13  5:56       ` Huang, Kai
2017-07-09  8:14 ` [PATCH 13/15] xen: tools: add new 'epc' parameter support Kai Huang
2017-07-09  8:15 ` [PATCH 14/15] xen: tools: add SGX to applying CPUID policy Kai Huang
2017-07-09  8:16 ` [PATCH 15/15] xen: tools: expose EPC in ACPI table Kai Huang
2017-07-12 11:05   ` Andrew Cooper
2017-07-13  8:23     ` Huang, Kai
2017-07-14 11:31   ` Jan Beulich
2017-07-17  6:11     ` Huang, Kai [this message]
2017-07-17 10:54   ` Roger Pau Monné
2017-07-18  8:36     ` Huang, Kai
2017-07-18 10:21       ` Roger Pau Monné
2017-07-18 22:44         ` Huang, Kai
2017-07-11 14:13 ` [RFC PATCH 00/15] RFC: SGX virtualization design and draft patches Andrew Cooper
2017-07-17  6:08   ` Huang, Kai
2017-07-21  9:04     ` Huang, Kai
2017-07-17  9:16 ` Wei Liu
2017-07-18  8:22   ` Huang, Kai
2017-07-28 13:40     ` Wei Liu
2017-07-31  8:37       ` Huang, Kai

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=10dc0bd3-d87d-1706-8d0b-9300d07fb607@linux.intel.com \
    --to=kai.huang@linux.intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=kaih.linux@gmail.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 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.