From patchwork Thu Oct 7 17:56:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B8C0C433F5 for ; Thu, 7 Oct 2021 18:10:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DA4116121F for ; Thu, 7 Oct 2021 18:10:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DA4116121F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYXqE-00017I-Tp for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 14:10:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39816) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXd1-0004W4-NJ for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXd0-0005Xc-3g for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633629381; 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=D3KeWMujpgQnxOaY0BqY6teDMQcXAmxFl6Dj/E3bCc2aF9/FkgrHyIkc2EgABJp5InGbVx g8WSSoJh+2zK7/K3Ny6TlKekteeZ4FbxIKT3rHS3Co9rXIvr6aTjJ7v/H1PyzD6cSYIML6 n1QLWFfYdQTJ29jQfZ8G5yetY+sSY28= 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-146-h0jkpLk0NFG9BRy1VA5-nA-1; Thu, 07 Oct 2021 13:56:19 -0400 X-MC-Unique: h0jkpLk0NFG9BRy1VA5-nA-1 Received: by mail-wr1-f70.google.com with SMTP id l6-20020adfa386000000b00160c4c1866eso5317853wrb.4 for ; Thu, 07 Oct 2021 10:56:19 -0700 (PDT) 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=17Jhhd8W+1GLPik9UvFj1kKpMAdzVoys258nt5atgiZJGtxf5BGG944xGIU6aBizzC 1YhStOcgnbx+y723EipUEeJSyV7PGMEspAJwB7WpAyKg8tnsVeD3CYv/UAtfAxf8+6HP 5ywGzD163wcy8wanSdxwvbOcoxQCB188Mjb4NbGzZM8QZD/M5giDnvxmQlg8ZeZKBl9A 5pDVzI7+N+eFrOkvS/Ha1aPryHM9teqDbIW4Zdog54RD02ZCRD7pDv4tpBF8dmI7Tm0w SKDEg8DxUCbqsupsx6hMHJz/DGcF4Drz8GPJNqEjjk7ix+hTb6+Pxs1N+4akS1enT0Tk 8/zw== X-Gm-Message-State: AOAM532+PyF/+h9NY2Pg2UFFhYCUhwXIiCqbHz4HTG57XmaZaythUdJZ LlvaK/JCA9l/pUhZMeN7uffaM7aXxrpxvhDIGZ/0thRZf98yf4ZbbdEuJpbhRmI2sD4iQeViedC +wGvw/IPs/Qi9s/kR7ZMrFS2zLzBauFPrLq0PbLztC2gkbE2hSeOmJlm1C9N14gpt X-Received: by 2002:adf:d1c4:: with SMTP id b4mr7278655wrd.356.1633629378182; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=170.10.133.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong , Eduardo Habkost , "Michael S. Tsirkin" , Marcelo Tosatti , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Cc: Yang Zhong Cc: Paolo Bonzini Cc: Marcelo Tosatti Signed-off-by: Philippe Mathieu-Daudé --- 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 From patchwork Thu Oct 7 17:56:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542571 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B98FC433F5 for ; Thu, 7 Oct 2021 18:04:00 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2094361175 for ; Thu, 7 Oct 2021 18:04:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2094361175 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:37624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYXkN-0007o5-43 for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 14:03:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXd5-0004m6-TF for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:27 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29984) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXd3-0005ak-U8 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:27 -0400 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= 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-445-y69AtVXWN9-YYFvKr99xTQ-1; Thu, 07 Oct 2021 13:56:24 -0400 X-MC-Unique: y69AtVXWN9-YYFvKr99xTQ-1 Received: by mail-wr1-f72.google.com with SMTP id f11-20020adfc98b000000b0015fedc2a8d4so5344011wrh.0 for ; Thu, 07 Oct 2021 10:56:24 -0700 (PDT) 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=AdqMGrL0kjdvOC8IZSSmF8+dISJ5xpICpzARb2Kqpv8DkobhsAywioH42jSEkUbXwd xGo34rOhcYhlC5YPxdauGtiRGaqiovbbaYhkEAH2kmd9v77Ptlcr7oAQ1IsT1fRrT6GG HcGJdSJrwLl1BHRBTgnDLcy7ZOJ/IVPcTJapdxgIRWZC7eC1VSavZA0OBAm6V/FEUtRh d51w3wxbaNFEct9KuLt3uoAT+bsMS64Cofsm85YU6diKkRRS3NYSHTRx8MVu9cQPPeEL dYK+ys2dgp92kQK7gMmua/i9NASJYIxx563EFmilVNV8NctVHIea4L6pXNflD8aQF+nM DmNA== X-Gm-Message-State: AOAM5320SwX+YAuP3lNndgMevJKDgbjsTTF3xfTWcLrdQSa0owa8Rz8E OrDraGR/kxMXHpqdeZp8s3D9QvVQ/cvCS90sXLDaqS72c6m8e71KcX8XGSxnmJSbyFj4Eh/+r9H XLs1GNDsn4E3TsQJsb5aQg+KdWbfb49buHANgX3++n2g7uMHZNozea62Oy1W0LRqy X-Received: by 2002:adf:b604:: with SMTP id f4mr7415414wre.111.1633629383019; Thu, 07 Oct 2021 10:56:23 -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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Philippe Mathieu-Daudé --- 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; -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); 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)); } -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; } -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 = PC_MACHINE(qdev_get_machine()); SGXEPCDevice *epc; if (pcms->sgx_epc.size == 0 || pcms->sgx_epc.nr_sections <= section_nr) { - return 1; + return true; } epc = 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 = epc->addr; *size = memory_device_get_region_size(MEMORY_DEVICE(epc), &error_fatal); - return 0; + return false; } void pc_machine_init_sgx_epc(PCMachineState *pcms) From patchwork Thu Oct 7 17:56:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542577 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3007C433EF for ; Thu, 7 Oct 2021 18:06:46 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6EBB561039 for ; Thu, 7 Oct 2021 18:06:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6EBB561039 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYXn3-0004L3-Ia for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 14:06:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39914) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXdA-00052b-GI for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXd8-0005et-O3 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:32 -0400 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= 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-307-kb_EHTYKMtaK42xIF_WMpw-1; Thu, 07 Oct 2021 13:56:29 -0400 X-MC-Unique: kb_EHTYKMtaK42xIF_WMpw-1 Received: by mail-wr1-f72.google.com with SMTP id r16-20020adfbb10000000b00160958ed8acso5314862wrg.16 for ; Thu, 07 Oct 2021 10:56:28 -0700 (PDT) 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=pnxFpql8apwjbTLWIQtZjLzDntuKSOylYxSYaLX1NUBTqCdBBcHSTnIyh/AlgDJYvF 9+0wBt5wsgLpGcRu3xk4Om8aiK89ehrhUJCYQR7dP0cAWajrvh3OyMLJOZ+pDYqbpO97 R8MgRUlQ4vf5VPjxm37XA7tz2hWQClXxy3jYBWJe13PQt73eeHP+ciRUbDvBHQEkcDSJ HGDt1ROBGNhm+UH/TGy5sgVxVe8BCPAZh7qmvdjv0D5dLIiuYp1X69ifrgbHVBL5q3y2 x993giXlmVKmEHF5iKU24o+muizOmdPCRUoMc5AiOs2oGEV2hMm/ojiV2QZaXAaXmP03 FPxg== X-Gm-Message-State: AOAM53190EKzqP3ZDWA3pkoMMCNh7rVi/+02T00kmjEnHBHs2EDpUqZh dzans0drsxypKSAWu07Lsplgt4P633ozyy0jSKzX9X+yPg8sfdSDqYBnS2+3YEZmCxCERVj1Zju d5sp6KO19P51qXlodxz+mi567QAWGRc/rysVu6lxjayTsXut9sFABIbVwEJ6fLa9b X-Received: by 2002:adf:bc48:: with SMTP id a8mr7118431wrh.19.1633629387584; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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" SGXInfo *sgx_get_info(Error **errp); -SGXInfo *sgx_get_capabilities(Error **errp); #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" SGXInfo *sgx_get_info(Error **errp) { @@ -9,7 +11,7 @@ SGXInfo *sgx_get_info(Error **errp) return NULL; } -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; } -SGXInfo *sgx_get_capabilities(Error **errp) +SGXInfo *qmp_query_sgx_capabilities(Error **errp) { SGXInfo *info = 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); -} From patchwork Thu Oct 7 17:56:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 12542583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20D9AC433EF for ; Thu, 7 Oct 2021 18:08:29 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B3BDC61039 for ; Thu, 7 Oct 2021 18:08:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B3BDC61039 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:49636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYXoh-0007SW-SW for qemu-devel@archiver.kernel.org; Thu, 07 Oct 2021 14:08:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXdI-0005Fb-83 for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33529) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYXdF-0005kr-MZ for qemu-devel@nongnu.org; Thu, 07 Oct 2021 13:56:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633629397; 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=UEKG7J4R+StnxghGTwqAusUuxcRj+c6kEGsZQD+brGa3l3wlMAtJnlrq4v/qiCmoJuvOVr hOIr2/RQbDofylwhxOs/2TKaQekwW6boIlmB/HninjmvleJe7E42BPKJ4EaQRlUKJS249U 5DDAS/aBf7BldqwvPoF06dMNlavN++Q= 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-173-hune7NzVNiK9CkQc4tuvJg-1; Thu, 07 Oct 2021 13:56:34 -0400 X-MC-Unique: hune7NzVNiK9CkQc4tuvJg-1 Received: by mail-wr1-f71.google.com with SMTP id 75-20020adf82d1000000b00160cbb0f800so4556974wrc.22 for ; Thu, 07 Oct 2021 10:56:33 -0700 (PDT) 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=f5Sy3N9wMnjeX6GELhJqcTPeX1HpV+pFc9vpec3ubO1naOw3/XLI+d1TpYzpdw2NUG SIhj4vbd0gt7lfE9zFJ/Xe2zQAl1WG4p4/EgXPfAD6ZXTmYg3Uc9jtSz7oOx7kBuA0WN NYNvZPqRo+qru8sTYWu6hnkavVYCtWZ+vKRUXjKAHFORn2Qd9XLSjki3X/QquwrkUYN/ 6bxHoF+waCAIFWB6UXI/l63wuCOTZ2SpWF2OuZq1OTzbDN6eNqyORiwQXvcPCckjimPY jDK8UZynix2aWN1hih9GJ45cKNobRKBFUQ8mEktqI0z26j/NTXLrbXs75C+Qt/yrJDKj ZGfA== X-Gm-Message-State: AOAM532N7BiQW/XaYzb1LkG3cC20WZCilEdLBpVIqFd4ss610CRyUNpl O5sMPeAwgkvIofxpjmqs60kwOOGyTjxfUyT0l/dYbwLhNLMXQcSTotQlQnI0taexTEGKbPMChid 1AmrGvzKt1L5275F4g+dkLKFtEZa1bMVG+hnvDHNTYqi+A5lEIjQzrY/ztb8b9SIw X-Received: by 2002:a05:6000:2cf:: with SMTP id o15mr7419450wry.364.1633629392528; 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) 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) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org 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 Received-SPF: pass client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yang Zhong , Eduardo Habkost , "Michael S. Tsirkin" , Richard Henderson , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" 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é --- 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" -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; } +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" #define SGX_MAX_EPC_SECTIONS 8 @@ -86,7 +87,7 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp) return info; } -SGXInfo *sgx_get_info(Error **errp) +SGXInfo *qmp_query_sgx(Error **errp) { SGXInfo *info = NULL; X86MachineState *x86ms; @@ -116,6 +117,27 @@ SGXInfo *sgx_get_info(Error **errp) return info; } +void hmp_info_sgx(Monitor *mon, const QDict *qdict) +{ + Error *err = NULL; + g_autoptr(SGXInfo) info = 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 = 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" /* 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 = NULL; - g_autoptr(SGXInfo) info = 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); -}