From: Paolo Bonzini <pbonzini@redhat.com>
To: Yang Zhong <yang.zhong@intel.com>, qemu-devel@nongnu.org
Cc: philmd@redhat.com, eblake@redhat.com
Subject: Re: [PATCH 5/6] numa: Enable numa for libvirt interface
Date: Tue, 12 Oct 2021 12:59:32 +0200 [thread overview]
Message-ID: <8b89a5d9-936c-d660-6546-6545d048368c@redhat.com> (raw)
In-Reply-To: <20211011111554.12403-6-yang.zhong@intel.com>
On 11/10/21 13:15, Yang Zhong wrote:
> Libvirt need get the detailed host SGX EPC capabilities to support
> numa function. Libvirt can decide how to allocate host EPC sections
> to guest numa from host numa info.
>
> (QEMU) query-sgx-capabilities
> {"return": {"sgx": true, "sgx2": true, "sgx1": true, "sections": \
> [{"index": 0, "size": 17070817280}, {"index": 1, "size": 17079205888}], "flc": true}}
>
> Signed-off-by: Yang Zhong <yang.zhong@intel.com>
> ---
> hw/i386/sgx.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c
> index 8af45925c6..fe3034060d 100644
> --- a/hw/i386/sgx.c
> +++ b/hw/i386/sgx.c
> @@ -74,11 +74,13 @@ static uint64_t sgx_calc_section_metric(uint64_t low, uint64_t high)
> ((high & MAKE_64BIT_MASK(0, 20)) << 32);
> }
>
> -static uint64_t sgx_calc_host_epc_section_size(void)
> +static SGXEPCSectionList *sgx_calc_host_epc_sections(void)
> {
> + SGXEPCSectionList *head = NULL, **tail = &head;
> + SGXEPCSection *section;
> uint32_t i, type;
> uint32_t eax, ebx, ecx, edx;
> - uint64_t size = 0;
> + uint32_t j = 0;
>
> for (i = 0; i < SGX_MAX_EPC_SECTIONS; i++) {
> host_cpuid(0x12, i + 2, &eax, &ebx, &ecx, &edx);
> @@ -92,10 +94,13 @@ static uint64_t sgx_calc_host_epc_section_size(void)
> break;
> }
>
> - size += sgx_calc_section_metric(ecx, edx);
> + section = g_new0(SGXEPCSection, 1);
> + section->index = j++;
> + section->size = sgx_calc_section_metric(ecx, edx);
> + QAPI_LIST_APPEND(tail, section);
> }
>
> - return size;
> + return head;
> }
>
> SGXInfo *sgx_get_capabilities(Error **errp)
> @@ -119,7 +124,7 @@ SGXInfo *sgx_get_capabilities(Error **errp)
> info->sgx1 = eax & (1U << 0) ? true : false;
> info->sgx2 = eax & (1U << 1) ? true : false;
>
> - info->section_size = sgx_calc_host_epc_section_size();
> + info->sections = sgx_calc_host_epc_sections();
>
> close(fd);
>
>
This too.
Paolo
next prev parent reply other threads:[~2021-10-12 11:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 11:15 [PATCH 0/6] SGX NUMA support Yang Zhong
2021-10-11 11:15 ` [PATCH 1/6] numa: Enable numa for SGX EPC sections Yang Zhong
2021-10-11 16:32 ` Eric Blake
2021-10-20 7:02 ` Yang Zhong
2021-10-11 11:15 ` [PATCH 2/6] monitor: Support 'info numa' command Yang Zhong
2021-10-11 11:15 ` [PATCH 3/6] numa: Add SGXEPCSection list for multiple sections Yang Zhong
2021-10-11 17:03 ` Eric Blake
2021-10-12 11:01 ` Paolo Bonzini
2021-10-20 8:06 ` Yang Zhong
2021-10-12 11:01 ` Paolo Bonzini
2021-10-20 8:08 ` Yang Zhong
2021-10-11 11:15 ` [PATCH 4/6] monitor: numa support for 'info sgx' command Yang Zhong
2021-10-12 10:59 ` Paolo Bonzini
2021-10-20 7:08 ` Yang Zhong
2021-10-11 11:15 ` [PATCH 5/6] numa: Enable numa for libvirt interface Yang Zhong
2021-10-12 10:59 ` Paolo Bonzini [this message]
2021-10-11 11:15 ` [PATCH 6/6] doc: Add the SGX numa description Yang Zhong
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=8b89a5d9-936c-d660-6546-6545d048368c@redhat.com \
--to=pbonzini@redhat.com \
--cc=eblake@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yang.zhong@intel.com \
/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).