From nobody Tue Feb 10 16:58:07 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1688638805; cv=none; d=zohomail.com; s=zohoarc; b=h5rHtFetY+0ExDAkT7DRfP7uJ6ufBPkN2r96p0dFWwUDSzMCsAH4iJuxWDybbgZE/+qPnNxu8qSG/XuY/kNkSvPdGRHcDpMO2IdhHA0V7v6GPBC3cuLJiSHphcc55uPKEJuWkKCBK3AJjSIf2khstmo0gjq4+dhbYTXmtQB3phc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1688638805; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Zsw0pJ1ZMaa7pJqxBp9+XWOi9ryOdYncMUElEND8Y8o=; b=clztWou+tekKtdhCzbCv7LqiLNZ+N7uKi8P4ytX1kRms9b55usvFGwwSrPtWWkxcSHRjdJC/ogFKseDuogFEV91JxV6t/MPpHX9QYe+LvRVmgSegkLy3fCe98OeH6ld1C7jk6BuFVYYSbFU7JlMjxKvyqrTP7aOR9YuhO92/G9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1688638805844520.393315113306; Thu, 6 Jul 2023 03:20:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qHM3x-0004sa-Og; Thu, 06 Jul 2023 06:18:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qHM3v-0004ry-UV for qemu-devel@nongnu.org; Thu, 06 Jul 2023 06:18:11 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qHM3t-0006bi-QN for qemu-devel@nongnu.org; Thu, 06 Jul 2023 06:18:11 -0400 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6b7206f106cso439482a34.1 for ; Thu, 06 Jul 2023 03:18:09 -0700 (PDT) Received: from grind.. (201-69-66-110.dial-up.telesp.net.br. [201.69.66.110]) by smtp.gmail.com with ESMTPSA id h25-20020a9d6a59000000b006b8850ad193sm511382otn.56.2023.07.06.03.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 03:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1688638688; x=1691230688; 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=Zsw0pJ1ZMaa7pJqxBp9+XWOi9ryOdYncMUElEND8Y8o=; b=TOa+6qxfUaQJHAOPtKiPjmy8fUSyadQNweLwmiFbcaikuK9RirZAuKDhYOpc8EzRfp /6VOzxp6JTHcWERm4Ifg6sXanM/PKsRgeQGkOawvUUjrNKS9zG80JHH8mA4xXPolKQeB 9nrOensZBvgtMYfHEp1PxJPeoaDciaSPIfHGw6ZuuRpx6uM93qZgmAUG5kIlr9NZxxOl lOJ9myHuHWZdA/JVLRRdmdMVHwSUj+B++wBUe+DKxEXX9XchgETMFWBbhLg/z10pBFVD StP4xfWXvQmzQoBfYpinl8wtyrq/rH5I8Eglt8Wu12DbWLDkmTpmfkiTDZ3CCI2lHkg2 5HRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688638688; x=1691230688; 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=Zsw0pJ1ZMaa7pJqxBp9+XWOi9ryOdYncMUElEND8Y8o=; b=XRPPW7CzXe+smc9eIxuJUSI934bKCfxQ6pFZuZi7IeIfoIHvKRQjGVUYC4pGt1UTpn irH8H5z1BaptbPEhV76+3wxWQ+I28HY9TkVhn/Zsur4YWdjvY5+dvD8rxRO9zW9hi2Wq x0cJH1SyV3Yt31IQ/sMbmmtepp5BRRS6XfDWFN1HXnI0ygw0LC1h5eTDm8Y7sjJCpcVV nOvhk2nu4tqkazDfoLHNn//MmUTzJQw4CmSulD9tWK3VPNTO/iBjZB3xxLqARMn/JLnC b0FdfGkWyBcL0wpdi1W2Fx1xZm17pJWvZegFgK5SR9o8vIdtW54rR7xNmioGdIRgnbk6 ihFA== X-Gm-Message-State: ABy/qLZXPBmV/p/ZiJi1ZymK3mp7uPKI5sG8j7YnzRupf7HY+8FQiXzH t2lbfHH7wFGmXzdMNWVhEubkW4UTY3yj8OLUrHk= X-Google-Smtp-Source: APBJJlF1QO7vQs4xtWourJStdtmg6cxWkQ9QQ8gVgPVbkKcwNv0dRrNQSis/sLgPzbii05pPy813aw== X-Received: by 2002:a05:6830:1d5b:b0:6b8:9a14:91f5 with SMTP id p27-20020a0568301d5b00b006b89a1491f5mr1646074oth.21.1688638688402; Thu, 06 Jul 2023 03:18:08 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com, bmeng@tinylab.org, liweiwei@iscas.ac.cn, zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com, ajones@ventanamicro.com, Daniel Henrique Barboza Subject: [PATCH v9 07/20] target/riscv: read marchid/mimpid in kvm_riscv_init_machine_ids() Date: Thu, 6 Jul 2023 07:17:25 -0300 Message-ID: <20230706101738.460804-8-dbarboza@ventanamicro.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230706101738.460804-1-dbarboza@ventanamicro.com> References: <20230706101738.460804-1-dbarboza@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=dbarboza@ventanamicro.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @ventanamicro.com) X-ZM-MESSAGEID: 1688638808120100003 Content-Type: text/plain; charset="utf-8" Allow 'marchid' and 'mimpid' to also be initialized in kvm_riscv_init_machine_ids(). After this change, the handling of mvendorid/marchid/mimpid for the 'host' CPU type will be equal to what we already have for TCG named CPUs, i.e. the user is not able to set these values to a different val than the one that is already preset. Signed-off-by: Daniel Henrique Barboza Reviewed-by: Andrew Jones Acked-by: Alistair Francis --- target/riscv/kvm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c index 37f0f70794..cd2974c663 100644 --- a/target/riscv/kvm.c +++ b/target/riscv/kvm.c @@ -378,6 +378,22 @@ static void kvm_riscv_init_machine_ids(RISCVCPU *cpu, = KVMScratchCPU *kvmcpu) if (ret !=3D 0) { error_report("Unable to retrieve mvendorid from host, error %d", r= et); } + + reg.id =3D kvm_riscv_reg_id(env, KVM_REG_RISCV_CONFIG, + KVM_REG_RISCV_CONFIG_REG(marchid)); + reg.addr =3D (uint64_t)&cpu->cfg.marchid; + ret =3D ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, ®); + if (ret !=3D 0) { + error_report("Unable to retrieve marchid from host, error %d", ret= ); + } + + reg.id =3D kvm_riscv_reg_id(env, KVM_REG_RISCV_CONFIG, + KVM_REG_RISCV_CONFIG_REG(mimpid)); + reg.addr =3D (uint64_t)&cpu->cfg.mimpid; + ret =3D ioctl(kvmcpu->cpufd, KVM_GET_ONE_REG, ®); + if (ret !=3D 0) { + error_report("Unable to retrieve mimpid from host, error %d", ret); + } } =20 void kvm_riscv_init_user_properties(Object *cpu_obj) --=20 2.41.0