Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp912380rwr; Wed, 19 Apr 2023 15:19:51 -0700 (PDT) X-Google-Smtp-Source: AKy350aqESk6XnKp5Y3XCOc3EFyXiA1/FUJyfdbJepKlF9P41m9ss9BjUugL+SS/mNIe8OGlR7Vl X-Received: by 2002:a05:6a00:a23:b0:627:f1f1:a97d with SMTP id p35-20020a056a000a2300b00627f1f1a97dmr5684449pfh.24.1681942790738; Wed, 19 Apr 2023 15:19:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681942790; cv=none; d=google.com; s=arc-20160816; b=C9RKiVMAYtoTGP73PtKs3ubpPNY0BsBN+2H2dLy7jhzzQnW3pzP2M0WKKUJ3VVNlna 7xK9ialcy7s3KEknW8jrfU4XtJ+Nuu6CT3+qrVh9IZBptP8b/pjPSvOYuXdyBAecrCYM cWDX0mnD4bzQ3goQ3xMQrKRfnTkBISrKWFiERJRcgATn+4bTDHJQErWMc9nxDoXJiKoK bQvpVvLG+luKl6j9cKZdOtKZFjC4QK7XDXIPgsPgfwPj+AkH5l/smFua9MF7RH3A5j+b yIj4+SZ3Tfkbb2fFamIVAemOwc6ZRfoMaJdMvZTbLxEdJAZp9d7wesQoN73XxsfgXl2k zJGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xru1T6bsi1+3ZKp8XjmLeeEUO6sc9QurHQCwhhM84HA=; b=H/4OZLCN/cUAIyIUs6e84wI8X5TGEY13No8zRqT9FOgb3V9xNc1dDEMto7lLA0ILCz jUy4kFN2ydQifhmDC2ZK7gT6TAsCxiYAK6tTuoCLSu7LGDriZHDDwBs56RCDBQpywr66 ffC0X8x048+F9A4wNGvbiI5+UD+luNGRSfbVbdkYMwg8ev+Fw94TvpoVZQhhpCLeGshs q6c7n4Bv27xy/0Yv0vtWVkX6/NdF4MTxhj1iCe1ANtAGaQzcUgMN3Tkm+4QhQkBiGWr2 tnRxdSeuABKly1OwLZ5d0v0NLKoIgDCrfh0n2wetyfhnzBd4VyRrox8ai/Wo7mranDmM BP0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=fB9b4YMt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020aa79827000000b0063b8e23415esi8767381pfl.92.2023.04.19.15.19.16; Wed, 19 Apr 2023 15:19:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20221208.gappssmtp.com header.s=20221208 header.b=fB9b4YMt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231368AbjDSWSc (ORCPT + 99 others); Wed, 19 Apr 2023 18:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231537AbjDSWSP (ORCPT ); Wed, 19 Apr 2023 18:18:15 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A77D7EC9 for ; Wed, 19 Apr 2023 15:17:51 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1a66b9bd7dfso5211285ad.2 for ; Wed, 19 Apr 2023 15:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20221208.gappssmtp.com; s=20221208; t=1681942667; x=1684534667; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xru1T6bsi1+3ZKp8XjmLeeEUO6sc9QurHQCwhhM84HA=; b=fB9b4YMtcQOYrcKj9/GWzeONjcxKP2oeywQTvv9jgtHPhKMG6piGSirEiNQPiRUSw/ TNDD98EsCQRHJb8o4KR/40iwkDz2iCL9O1Q5D4OApUqfzyyueF2pWWXu9oUBTr1sBd7r qN8+st+530NNWaQglZ+vx32ZFpdd6jtoI22iSuSF0a+tcpVy60XJq7vb5hms8XM51miU EUekIXnr0Cbflr87WbR+EkVxvu0imyYB9o1bwvrkRw5vQJ9T+Gvh04UNMDx3e/rdtmef Rhm+A3oBDjRklFUpsePBjaVMWeVQWCFlRT5JvPLYOIPW/X1HEUctXf38yhKlTJ/Aw1FH TvXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681942667; x=1684534667; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xru1T6bsi1+3ZKp8XjmLeeEUO6sc9QurHQCwhhM84HA=; b=MXcUSW+X4tERyHSvlSj+vp0XEwOtSZMtjqwDV8CHg4GfzvXg5X0kBbiKbVvr1ZOWKC xDRXKtqZ5ROnxoQqxD4b9uIyaF5vOaMIz9QvGdk2dhPM2i0/jdg1AW5AtTgnbWN1aTCK 7jEELiw9UhqrsZ6606gS2M5Qgm+3myHYSCOGOCO7/65cXrqkNQ/E+wrSg5Jlclrv9Bqz OkW0mFL3E7wj/VYoez09uMSaYY4s7758OAzDNhJkvJJXuvgCK7YU/LC12hrafOJxCiSG ilF+aV/YB1QDNcVdeDfSgFrItKbeLBGQIz9In+c1mC+gYFDghjZ6txHOTPi9Nhb7BBIL xdgA== X-Gm-Message-State: AAQBX9fObZ0UkM3A7H5JwVaTJNdspvMv7eA2SaCkZ4cjfOLdK8cJaUVI Q60xf5YmPBf25zk2JF4i0uL/Ap9mS6mC3ukI0lk= X-Received: by 2002:a17:902:f682:b0:1a1:f5dd:2dce with SMTP id l2-20020a170902f68200b001a1f5dd2dcemr8068605plg.6.1681942667389; Wed, 19 Apr 2023 15:17:47 -0700 (PDT) Received: from atishp.ba.rivosinc.com ([66.220.2.162]) by smtp.gmail.com with ESMTPSA id jn11-20020a170903050b00b00196807b5189sm11619190plb.292.2023.04.19.15.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Apr 2023 15:17:47 -0700 (PDT) From: Atish Patra To: linux-kernel@vger.kernel.org Cc: Atish Patra , Alexandre Ghiti , Andrew Jones , Andrew Morton , Anup Patel , Atish Patra , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Suzuki K Poulose , Will Deacon , Marc Zyngier , Sean Christopherson , linux-coco@lists.linux.dev, Dylan Reid , abrestic@rivosinc.com, Samuel Ortiz , Christoph Hellwig , Conor Dooley , Greg Kroah-Hartman , Guo Ren , Heiko Stuebner , Jiri Slaby , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, Mayuresh Chitale , Palmer Dabbelt , Paolo Bonzini , Paul Walmsley , Rajnesh Kanwal , Uladzislau Rezki Subject: [RFC 08/48] RISC-V: KVM: Add UABI to support static memory region attestation Date: Wed, 19 Apr 2023 15:16:36 -0700 Message-Id: <20230419221716.3603068-9-atishp@rivosinc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419221716.3603068-1-atishp@rivosinc.com> References: <20230419221716.3603068-1-atishp@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To initialize a TVM, a TSM must ensure that all the static memory regions that contain the device tree, the kernel image or initrd for the TVM attested. Some of these information is not usually present with the host and only VMM is aware of these. Introduce an new ioctl which is part of the uABI to support this. Signed-off-by: Atish Patra --- arch/riscv/include/uapi/asm/kvm.h | 12 ++++++++++++ include/uapi/linux/kvm.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index 11440df..ac3def0 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -98,6 +98,18 @@ struct kvm_riscv_timer { __u64 state; }; +/* Memory region details of a CoVE guest that is measured at boot time */ +struct kvm_riscv_cove_measure_region { + /* Address of the user space where the VM code/data resides */ + unsigned long userspace_addr; + + /* The guest physical address where VM code/data should be mapped */ + unsigned long gpa; + + /* Size of the region */ + unsigned long size; +}; + /* * ISA extension IDs specific to KVM. This is not the same as the host ISA * extension IDs as that is internal to the host and should not be exposed diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index a55a6a5..84a73b5 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1552,6 +1552,8 @@ struct kvm_s390_ucas_mapping { #define KVM_PPC_SVM_OFF _IO(KVMIO, 0xb3) #define KVM_ARM_MTE_COPY_TAGS _IOR(KVMIO, 0xb4, struct kvm_arm_copy_mte_tags) +#define KVM_RISCV_COVE_MEASURE_REGION _IOR(KVMIO, 0xb5, struct kvm_riscv_cove_measure_region) + /* ioctl for vm fd */ #define KVM_CREATE_DEVICE _IOWR(KVMIO, 0xe0, struct kvm_create_device) -- 2.25.1