From nobody Sun Feb 8 12:32:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633629381; cv=none; d=zohomail.com; s=zohoarc; b=ZWUoVRI5JFmPTC57+sUuRcp5+D18ebJxqu3786kxXi6aQ212kYbWYS6CjglKxMgnhURNy5dxmiENZ3ADmB6FJ7ILdciM6dorE2nCc1k03pUKWHI7MeMH7uW70E42PZpS7iTwqddxw84ieSBluCwhduD2LihQMtQMr0XT05AjlDQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633629381; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=FZVjcgkP4eJJl8An6XCiksZGp8eMqhiHN5s8v/EvDhg=; b=JglOCNLksb/Ca2nO6hlAtg0KpJG7bkyCcKJYKZaV/DLQ5bc5XJETomxMwqzgLHGaJgd4OV7QZSSDJxTitU7iQloGsW09Ngp/QVRUBMGYUogI4oLcW82ekUlQ0VAlCRx6jBYrE/etD2myXALLQcH/V1JHAH6zuCKkK71zPxK4jyI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633629381396241.67812714566173; Thu, 7 Oct 2021 10:56:21 -0700 (PDT) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-yh-SnW1WPyST7vuah9BngA-1; Thu, 07 Oct 2021 13:56:19 -0400 Received: by mail-wr1-f70.google.com with SMTP id 41-20020adf812c000000b00160dfbfe1a2so1649214wrm.3 for ; Thu, 07 Oct 2021 10:56:18 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id k17sm13128wrc.93.2021.10.07.10.56.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 10:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633629380; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FZVjcgkP4eJJl8An6XCiksZGp8eMqhiHN5s8v/EvDhg=; b=a3tBvB4WafgNBeiQMAEnXyL2sVmUp5h6zZlixgyTBFhWnJu8YpdLdd4fx7gv9eksbBPk8l mqvGqX6rRl6TywmxRYNlIL+KdzvS8MWWM1IsBoKBiOEtnAG+IU4FCAX/kX3vFRRsV3eNZB jOo/njzn/FreUnoHA0o5yFvDFMHf19Q= X-MC-Unique: yh-SnW1WPyST7vuah9BngA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FZVjcgkP4eJJl8An6XCiksZGp8eMqhiHN5s8v/EvDhg=; b=e/FBjUotDBbHnKTc9+INNykbh3r7uLKeVbIQEdD8KX1pKoLIMgVgafXQcEU2R/cBBO JBahdB8rWKaYCmcf/Vem+dgTKUYjfUjCZZ82Gi/JjIv+mmQ0z95ssfy+ek9MMlNXttXW lEiitAXdonaACsITakdVawZ33hqKGzB5RUK9JehQRntla/rNH8PFr8TzOzxMC2Xsmjd8 7sfl7JnsfRSsqhyJBha/POwIHkkH0JLaP3p6p1jHyhX9wSPrHn+JcW23ddhYLhI4sqKW Eagx3wTJfrtN5esRGnYgUNw0LAoWKutr86Es0ffygT9FqL6NR01HSTVRIa41swRdtt83 Ez/A== X-Gm-Message-State: AOAM530F6PXSf2P0nQoR9SMJTetgZVMb1YI1X6dmFpDxd5VyroMId38W YqhdHUk5eqLT8DoYbJhZ/YowCK3MVRygn6KxC2jnRRhSa1HoEpzkk+EPDIgALZ5y77klUtWilBP xgxki4e2haZRGaQ== X-Received: by 2002:adf:d1c4:: with SMTP id b4mr7278634wrd.356.1633629378096; Thu, 07 Oct 2021 10:56:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXcrZxEq0zE1KxGLK7GORHRQff+PENSO+uo8sA9P30h6bxl88lbstHkqQIC9vF5iZyEstiFg== X-Received: by 2002:adf:d1c4:: with SMTP id b4mr7278619wrd.356.1633629377977; Thu, 07 Oct 2021 10:56:17 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Yang Zhong , Marcel Apfelbaum , Richard Henderson , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Marcelo Tosatti Subject: [PATCH 1/4] MAINTAINERS: Cover SGX documentation file with X86/KVM section Date: Thu, 7 Oct 2021 19:56:09 +0200 Message-Id: <20211007175612.496366-2-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007175612.496366-1-philmd@redhat.com> References: <20211007175612.496366-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633629383285100001 Cc: Yang Zhong Cc: Paolo Bonzini Cc: Marcelo Tosatti Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index a49555d94d5..cb8cb48a51b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -418,6 +418,7 @@ M: Marcelo Tosatti L: kvm@vger.kernel.org S: Supported F: docs/amd-memory-encryption.txt +F: docs/system/i386/sgx.rst F: target/i386/kvm/ F: target/i386/sev* F: scripts/kvm/vmxcap --=20 2.31.1 From nobody Sun Feb 8 12:32:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633629386; cv=none; d=zohomail.com; s=zohoarc; b=CRTGP9fspciTX+jpnh4WQZd0hgaasR3ff7OsB5cBHeMXCn+2A3fmK382IDAdsMpVPStK53nioUjgf8qOo60YQkv5sqUjUWKHIiqt09QXzGLIkE7db453afaLJWA/belxtK62xZjeh4VS3EuuShZ/Hy3PgCXQgXACPwmhz2Se/T4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633629386; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=qFn0xNqcF4MW7EjeaR5NNHmbJXwfQwjP26b2fQszn/g=; b=BOT8v14YsKwS1UwgYaQMZoflPUdOeREz/PFSGrwcF6B/R2C5V2P39t25XbQONCrJpxCRbIu9Vv5Lzkie/HqXXtPebfLYZwO/mgvoTFIRGBABsUpjgEvM+8zb8k6mWk7gWTI5fe5zKcYt5hq2D/fm46PG6wxtC3o7k9G3aCSoP3Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633629386247600.249490721289; Thu, 7 Oct 2021 10:56:26 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-w5IF0fJGPDqLHEMm7pDRbw-1; Thu, 07 Oct 2021 13:56:24 -0400 Received: by mail-wr1-f72.google.com with SMTP id j19-20020adfb313000000b00160a9de13b3so5321429wrd.8 for ; Thu, 07 Oct 2021 10:56:23 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id f3sm9051190wmb.12.2021.10.07.10.56.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 10:56:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633629385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qFn0xNqcF4MW7EjeaR5NNHmbJXwfQwjP26b2fQszn/g=; b=XcJv8HQ5tt3ZCHicpZrefsIclIqfVCm9lYwB3EtdBdDoXua5Y6u9WrDzL25Xp/Ip/VMOLl QdWFufeMJsQSzVP6me5ggM3cpzEffUWsUYYlZA5aSCd7rJcJzCwTuoeCuA9TnZOh9OdSLR aBUDAMUcGBDwPn4DGyoPibnzrhJJ+aU= X-MC-Unique: w5IF0fJGPDqLHEMm7pDRbw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qFn0xNqcF4MW7EjeaR5NNHmbJXwfQwjP26b2fQszn/g=; b=Eco0AstgNrMRvOMMALocbt/KzUP8e1wHBefB4tx6KPvxc0jnJt+5eSr7o1VBnI8jWu j5yXmccnmCddEjd+HizIf9blH9KsUpvHyJWwm8BnIpcx8hWh+0fdlltOEfWHFquu+mk9 WEh5NjSHUKtiC0kqdAzOyNsRD501KlXSS+fB+EbzOMTFIYIx9Bo8PFJwcAj3xqu7uX6T 3J1U8L+klhUUcOyLDQhH87P8pa9iYCaiJGzTSD2ESnZnBoYcOeJR3DnXMMB7Qe2R/xM1 0KFPOjwP670qNfLiLvt/uqu5hfktHfTaMmbBYmdYy0GrSAieAbxZK0O7slAYtB3sGwg6 /gmw== X-Gm-Message-State: AOAM5319poWQuaXBc1zsVbEXiscjsb+KQfIPH6s/6Cnn7XFwfwzVW32B oHj6QONULSBioK01LtD5hOH5ZA+2ChdutSf9ISaBR4mkmpTnJ7zfSu2DL7uQGBoHoUvboT1w+R6 TYflcX/u772BbnQ== X-Received: by 2002:adf:b604:: with SMTP id f4mr7415406wre.111.1633629382979; Thu, 07 Oct 2021 10:56:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzsCgOKSOfVA5bYVGnzUD3VFt7UdhAr3owYWMSntVmvv12DVuG8ibbpRXDKOxXWQ9eNoMzd6A== X-Received: by 2002:adf:b604:: with SMTP id f4mr7415390wre.111.1633629382835; Thu, 07 Oct 2021 10:56:22 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Yang Zhong , Marcel Apfelbaum , Richard Henderson , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 2/4] hw/i386/sgx: Have sgx_epc_get_section() return a boolean Date: Thu, 7 Oct 2021 19:56:10 +0200 Message-Id: <20211007175612.496366-3-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007175612.496366-1-philmd@redhat.com> References: <20211007175612.496366-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633629387919100001 Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i386/sgx-epc.h | 2 +- hw/i386/sgx-stub.c | 2 +- hw/i386/sgx.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/hw/i386/sgx-epc.h b/include/hw/i386/sgx-epc.h index 65a68ca753a..a6a65be854f 100644 --- a/include/hw/i386/sgx-epc.h +++ b/include/hw/i386/sgx-epc.h @@ -55,7 +55,7 @@ typedef struct SGXEPCState { int nr_sections; } SGXEPCState; =20 -int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size); +bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size); =20 static inline uint64_t sgx_epc_above_4g_end(SGXEPCState *sgx_epc) { diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c index 3be9f5ca32c..45c473119ef 100644 --- a/hw/i386/sgx-stub.c +++ b/hw/i386/sgx-stub.c @@ -20,7 +20,7 @@ void pc_machine_init_sgx_epc(PCMachineState *pcms) memset(&pcms->sgx_epc, 0, sizeof(SGXEPCState)); } =20 -int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) +bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) { g_assert_not_reached(); } diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index e481e9358f1..29724ff8f08 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -115,13 +115,13 @@ SGXInfo *sgx_get_info(Error **errp) return info; } =20 -int sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) +bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) { PCMachineState *pcms =3D PC_MACHINE(qdev_get_machine()); SGXEPCDevice *epc; =20 if (pcms->sgx_epc.size =3D=3D 0 || pcms->sgx_epc.nr_sections <=3D sect= ion_nr) { - return 1; + return true; } =20 epc =3D pcms->sgx_epc.sections[section_nr]; @@ -129,7 +129,7 @@ int sgx_epc_get_section(int section_nr, uint64_t *addr,= uint64_t *size) *addr =3D epc->addr; *size =3D memory_device_get_region_size(MEMORY_DEVICE(epc), &error_fat= al); =20 - return 0; + return false; } =20 void pc_machine_init_sgx_epc(PCMachineState *pcms) --=20 2.31.1 From nobody Sun Feb 8 12:32:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633629390; cv=none; d=zohomail.com; s=zohoarc; b=bkxnXxrP8RmkYDKb+23tOhnVdgL5tAsJmrY26vIjAQBRabbE8sUaAXMP9UsvB30IWi+wPexU7hoCl67abhZOLQBohIm/Gf7tI8GQkRk/S0//3CWhjGm54nuUEpHItxA5DW/2mHNqS/LhM1XWb417Lpkk2Ude8w6GNLfGHfahBjs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633629390; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7fgw+iLF03hU/h1yPH0+fm9VyX2b04jOBSqyKLGZY2M=; b=k3ae+189EgAt4mfcdGxA5wAOfGRP62ZCFq5SBhUQwg0VMV7TgAiQsVyT5nU6u+6BUxmZAWB4DsiUHX2YPI7xUfsT+kVLxtYz4PJAx9ljTsclP0+vCVjV59aU3Gl6hV09upu/XmnR+tOTb6oBCPMS5I3kqB1ynmheyzlv2uGsY88= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633629390921706.1739004485349; Thu, 7 Oct 2021 10:56:30 -0700 (PDT) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-588-L2rfOHV8PT2suXYxyC1oQA-1; Thu, 07 Oct 2021 13:56:28 -0400 Received: by mail-wr1-f72.google.com with SMTP id d13-20020adfa34d000000b00160aa1cc5f1so5318482wrb.14 for ; Thu, 07 Oct 2021 10:56:28 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id u17sm16972wrw.85.2021.10.07.10.56.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 10:56:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633629389; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7fgw+iLF03hU/h1yPH0+fm9VyX2b04jOBSqyKLGZY2M=; b=RfkT3lBABTRUzGT6I6V4BX8OIVmw9KXXXGhrlw1B+zAUqApMO9v7s+vlO1LbIcjEpc2Fa6 TkSi/Y4zIM7hAFoOyRv1ZXfIY7D0YOJMfAvlUJzQGC4Mn1NxJLXO7ft1X1BM/GHKDyCaZq xYpsbzXzsK9QtlVav9JBz196YZjEE3E= X-MC-Unique: L2rfOHV8PT2suXYxyC1oQA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7fgw+iLF03hU/h1yPH0+fm9VyX2b04jOBSqyKLGZY2M=; b=qxEF5cHm1F364UxYcreEsvrCZ2MaRfXXlhOkdQoZ+SPPWCoNqt59ECp5pK/IyhJlKR v35odUIaNeG5+AV1BrOWj7TIXC/e+WaTXy+oVFTgVOBhfGhg96Ozh4UZnZnKNO5G5oZm LIyrFIl67H+/Kz+KpLalmvgb2MHY9ug8Qne/Fh+t7APSKa56uiBlLLYn91SItrDvTPyE IMbhuLUTWzV+h+sog+xMHWvrMOgEjiDDa4U0ll94q+ROf5A1eCVMYGdVo+7mynYELFuX 9xEHtRYc0C0JWei6B15gyE2mY7Wz0FLgUVp3t0fTRHGdWiNUAugVZpMuRU09324KqlAc 1gGA== X-Gm-Message-State: AOAM53143nkpRd6zdaSuHpMbUIYVCv9bdlKKsd8cTgbryoHzlhKRRKtd shgBqi5jFlmV0/1YDtBKlE4qnxwD4xQ8lP06DedL+4R/gdTg9vnvG6zquL+6wC96BY4cjJ1M1Kd wtNp9UzpRGWqDVw== X-Received: by 2002:adf:bc48:: with SMTP id a8mr7118422wrh.19.1633629387536; Thu, 07 Oct 2021 10:56:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXg09UIXw/PyR6YZ0rdSVYedZwnDWbseQ9/cXgBGURa/nqhgWO7NiRH37q/7DEC7ugy6Ootw== X-Received: by 2002:adf:bc48:: with SMTP id a8mr7118401wrh.19.1633629387335; Thu, 07 Oct 2021 10:56:27 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Yang Zhong , Marcel Apfelbaum , Richard Henderson , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 3/4] hw/i386/sgx: Move qmp_query_sgx_capabilities() to hw/i386/sgx.c Date: Thu, 7 Oct 2021 19:56:11 +0200 Message-Id: <20211007175612.496366-4-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007175612.496366-1-philmd@redhat.com> References: <20211007175612.496366-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633629392523100003 Move qmp_query_sgx_capabilities() from target/i386/monitor.c to hw/i386/sgx.c, removing the sgx_get_capabilities() indirection. Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i386/sgx.h | 1 - hw/i386/sgx-stub.c | 4 +++- hw/i386/sgx.c | 3 ++- target/i386/monitor.c | 5 ----- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/hw/i386/sgx.h b/include/hw/i386/sgx.h index 16fc25725c4..2bf90b3f4fe 100644 --- a/include/hw/i386/sgx.h +++ b/include/hw/i386/sgx.h @@ -7,6 +7,5 @@ #include "qapi/qapi-types-misc-target.h" =20 SGXInfo *sgx_get_info(Error **errp); -SGXInfo *sgx_get_capabilities(Error **errp); =20 #endif diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c index 45c473119ef..3749656db1a 100644 --- a/hw/i386/sgx-stub.c +++ b/hw/i386/sgx-stub.c @@ -2,6 +2,8 @@ #include "hw/i386/pc.h" #include "hw/i386/sgx-epc.h" #include "hw/i386/sgx.h" +#include "qapi/error.h" +#include "qapi/qapi-commands-misc-target.h" =20 SGXInfo *sgx_get_info(Error **errp) { @@ -9,7 +11,7 @@ SGXInfo *sgx_get_info(Error **errp) return NULL; } =20 -SGXInfo *sgx_get_capabilities(Error **errp) +SGXInfo *qmp_query_sgx_capabilities(Error **errp) { error_setg(errp, "SGX support is not compiled in"); return NULL; diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 29724ff8f08..713f1363433 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -16,6 +16,7 @@ #include "hw/mem/memory-device.h" #include "monitor/qdev.h" #include "qapi/error.h" +#include "qapi/qapi-commands-misc-target.h" #include "exec/address-spaces.h" #include "hw/i386/sgx.h" #include "sysemu/hw_accel.h" @@ -57,7 +58,7 @@ static uint64_t sgx_calc_host_epc_section_size(void) return size; } =20 -SGXInfo *sgx_get_capabilities(Error **errp) +SGXInfo *qmp_query_sgx_capabilities(Error **errp) { SGXInfo *info =3D NULL; uint32_t eax, ebx, ecx, edx; diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 680d282591c..84fba47f193 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -700,8 +700,3 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict) monitor_printf(mon, "size: %" PRIu64 "\n", info->section_size); } - -SGXInfo *qmp_query_sgx_capabilities(Error **errp) -{ - return sgx_get_capabilities(errp); -} --=20 2.31.1 From nobody Sun Feb 8 12:32:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633629397; cv=none; d=zohomail.com; s=zohoarc; b=jAqKIgivIcl0JvyBfTvwDjnP1mCXt9oq+iGJzTWSyl+LQM39ytJnOLutijYw/jDUojLTGOfw8LncI9YsXxlpRe7aR5l4++It63Y9n3s6rQ4iua2rgXerudhxWx2jHJMY8a9Q+cLFdgxi1L8jcNSdbJr601Ok/ZCpiYJiYgdYkOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633629397; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=0XS07QnhJoyMRdHPV86+sTB0tINIseduV6cvpF8QwKg=; b=TUe7btV3Vm8Xc7Ls9NfqN8Ct4xvR4El0fCs4oEtz2tPRjagmEgAGPRqVkcP4CX2Hwb3Sa6tDeAQOgIKyZCqJpAKqsvsnQwE/lJjg2om1An+JVA2oRWRswnAp7CM/ihmudPKnY2DipXlfYnGeTw4NKqnw8RJnXEmtBVLWyqH+sMk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1633629397827718.9519675719351; Thu, 7 Oct 2021 10:56:37 -0700 (PDT) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-517-wxqHGmfxPFO2Ucog-tzKMg-1; Thu, 07 Oct 2021 13:56:33 -0400 Received: by mail-wr1-f71.google.com with SMTP id r21-20020adfa155000000b001608162e16dso5302213wrr.15 for ; Thu, 07 Oct 2021 10:56:33 -0700 (PDT) Return-Path: Return-Path: Received: from x1w.redhat.com (118.red-83-35-24.dynamicip.rima-tde.net. [83.35.24.118]) by smtp.gmail.com with ESMTPSA id d16sm8946913wmb.2.2021.10.07.10.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 10:56:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633629396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0XS07QnhJoyMRdHPV86+sTB0tINIseduV6cvpF8QwKg=; b=hC3fXCahZJ14Az77TpALzbGJW0g5mQ21QTpJ2ie8xALwkYcJBnMoPlEBYtzF5N9bWKoIY1 +UkTPIKXRKQVadT6iHQ7uAqYUtRPyXJ7PWGe2QsRSlWXvBHF4xYNu1EEYuJpCang60ueZN /ack0QO6/jVaQXNT/CsXNLX5weIUEYc= X-MC-Unique: wxqHGmfxPFO2Ucog-tzKMg-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0XS07QnhJoyMRdHPV86+sTB0tINIseduV6cvpF8QwKg=; b=Ow65xIHHI4w54LuxCJACvmxxsYZSs9Wbx7zE05hjV6RDFBkZ3OZB8QJGkJAlm47YX6 dzszN1EpYJih6wTFl9ARJ67bNbQJRdbQaQuVYXqmYCzhmD0b5A49QT0W3IRrlcaYEWqR LmjYjbLBiPeKgTk0iDMzLte1D2w/hrh/WxUNewRsMllg9Fu5sTBPezERLS5GwVbDjSmF OuYAKMlQzxSzja7dQF1+rwKDAD0iNotqWs+uiL1A1UQGMiM9JFgbLKmehK14YX3Br67j XxShGxIt+rB2ZpbnfJaNE1mt0NT65k5a6/Rh+6KFPZ5fcCvyHt4E3Y6c8huWOvCrZNAJ FOzQ== X-Gm-Message-State: AOAM5328em9nulx7urrUhBdSyo2/exJ+rBdOIemIanOsyF/l/r1/plH4 X584/CqAvtpbWTT+uZn5Xp3CYztwNjUSKbJyOFZqtg4Educ222kGaDK8wdmmxm3QeqCEKB2dhy7 C2j2YtLlayCuhsw== X-Received: by 2002:a05:6000:2cf:: with SMTP id o15mr7419434wry.364.1633629392428; Thu, 07 Oct 2021 10:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCTNtVuF0C096+h4EE6dtzdOy+/tu8jCax8f8MyCqrwJlI5sDE/nk5aH3JLxOriI7gsKxG5w== X-Received: by 2002:a05:6000:2cf:: with SMTP id o15mr7419411wry.364.1633629392170; Thu, 07 Oct 2021 10:56:32 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost , Yang Zhong , Marcel Apfelbaum , Richard Henderson , "Michael S. Tsirkin" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 4/4] hw/i386/sgx: Move qmp_query_sgx() and hmp_info_sgx() to hw/i386/sgx.c Date: Thu, 7 Oct 2021 19:56:12 +0200 Message-Id: <20211007175612.496366-5-philmd@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007175612.496366-1-philmd@redhat.com> References: <20211007175612.496366-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633629399089100001 Move qmp_query_sgx() and hmp_info_sgx() from target/i386/monitor.c to hw/i386/sgx.c, removing the sgx_get_info() indirection and the "hw/i386/sgx.h" header. Suggested-by: Paolo Bonzini Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i386/sgx.h | 11 ----------- hw/i386/sgx-stub.c | 10 ++++++++-- hw/i386/sgx.c | 26 ++++++++++++++++++++++++-- target/i386/monitor.c | 27 --------------------------- 4 files changed, 32 insertions(+), 42 deletions(-) delete mode 100644 include/hw/i386/sgx.h diff --git a/include/hw/i386/sgx.h b/include/hw/i386/sgx.h deleted file mode 100644 index 2bf90b3f4fe..00000000000 --- a/include/hw/i386/sgx.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef QEMU_SGX_H -#define QEMU_SGX_H - -#include "qom/object.h" -#include "qapi/error.h" -#include "qemu/error-report.h" -#include "qapi/qapi-types-misc-target.h" - -SGXInfo *sgx_get_info(Error **errp); - -#endif diff --git a/hw/i386/sgx-stub.c b/hw/i386/sgx-stub.c index 3749656db1a..c9b379e6651 100644 --- a/hw/i386/sgx-stub.c +++ b/hw/i386/sgx-stub.c @@ -1,11 +1,12 @@ #include "qemu/osdep.h" +#include "monitor/monitor.h" +#include "monitor/hmp-target.h" #include "hw/i386/pc.h" #include "hw/i386/sgx-epc.h" -#include "hw/i386/sgx.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" =20 -SGXInfo *sgx_get_info(Error **errp) +SGXInfo *qmp_query_sgx(Error **errp) { error_setg(errp, "SGX support is not compiled in"); return NULL; @@ -17,6 +18,11 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp) return NULL; } =20 +void hmp_info_sgx(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "SGX is not available in this QEMU\n"); +} + void pc_machine_init_sgx_epc(PCMachineState *pcms) { memset(&pcms->sgx_epc, 0, sizeof(SGXEPCState)); diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index 713f1363433..11607568b69 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -15,10 +15,11 @@ #include "hw/i386/sgx-epc.h" #include "hw/mem/memory-device.h" #include "monitor/qdev.h" +#include "monitor/monitor.h" +#include "monitor/hmp-target.h" #include "qapi/error.h" #include "qapi/qapi-commands-misc-target.h" #include "exec/address-spaces.h" -#include "hw/i386/sgx.h" #include "sysemu/hw_accel.h" =20 #define SGX_MAX_EPC_SECTIONS 8 @@ -86,7 +87,7 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp) return info; } =20 -SGXInfo *sgx_get_info(Error **errp) +SGXInfo *qmp_query_sgx(Error **errp) { SGXInfo *info =3D NULL; X86MachineState *x86ms; @@ -116,6 +117,27 @@ SGXInfo *sgx_get_info(Error **errp) return info; } =20 +void hmp_info_sgx(Monitor *mon, const QDict *qdict) +{ + Error *err =3D NULL; + g_autoptr(SGXInfo) info =3D qmp_query_sgx(&err); + + if (err) { + error_report_err(err); + return; + } + monitor_printf(mon, "SGX support: %s\n", + info->sgx ? "enabled" : "disabled"); + monitor_printf(mon, "SGX1 support: %s\n", + info->sgx1 ? "enabled" : "disabled"); + monitor_printf(mon, "SGX2 support: %s\n", + info->sgx2 ? "enabled" : "disabled"); + monitor_printf(mon, "FLC support: %s\n", + info->flc ? "enabled" : "disabled"); + monitor_printf(mon, "size: %" PRIu64 "\n", + info->section_size); +} + bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) { PCMachineState *pcms =3D PC_MACHINE(qdev_get_machine()); diff --git a/target/i386/monitor.c b/target/i386/monitor.c index 84fba47f193..8166e17693a 100644 --- a/target/i386/monitor.c +++ b/target/i386/monitor.c @@ -34,7 +34,6 @@ #include "qapi/qapi-commands-misc-target.h" #include "qapi/qapi-commands-misc.h" #include "hw/i386/pc.h" -#include "hw/i386/sgx.h" =20 /* Perform linear address sign extension */ static hwaddr addr_canonical(CPUArchState *env, hwaddr addr) @@ -674,29 +673,3 @@ void hmp_info_io_apic(Monitor *mon, const QDict *qdict) monitor_printf(mon, "This command is obsolete and will be " "removed soon. Please use 'info pic' instead.\n"); } - -SGXInfo *qmp_query_sgx(Error **errp) -{ - return sgx_get_info(errp); -} - -void hmp_info_sgx(Monitor *mon, const QDict *qdict) -{ - Error *err =3D NULL; - g_autoptr(SGXInfo) info =3D qmp_query_sgx(&err); - - if (err) { - error_report_err(err); - return; - } - monitor_printf(mon, "SGX support: %s\n", - info->sgx ? "enabled" : "disabled"); - monitor_printf(mon, "SGX1 support: %s\n", - info->sgx1 ? "enabled" : "disabled"); - monitor_printf(mon, "SGX2 support: %s\n", - info->sgx2 ? "enabled" : "disabled"); - monitor_printf(mon, "FLC support: %s\n", - info->flc ? "enabled" : "disabled"); - monitor_printf(mon, "size: %" PRIu64 "\n", - info->section_size); -} --=20 2.31.1