From patchwork Wed Oct 9 15:49:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13828707 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C7683CEE327 for ; Wed, 9 Oct 2024 15:55:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+3zZkwU+2EpnRGguJhn2Ww+Ghmvy6uOMqwsBdHy8Row=; b=ZuW/mUVAHfxhiywU8psxA6rl/2 zDM8+jRSezrRJdjIqPiN0wryolpSrkid0Q+UhMWZ/kqp2HxdnlqUf69bLagHd3sWYB83UEl3MUkSb /v15/71cnFWBA0EpPhqf5VgmZayOUJhRsVFDKanUMg+PLWSpxnh9aN8gtvc/VUxDQ58T/iFsKhDoV zkeiQKAUAF3eD6aKRJ5TMD5dYLduhN9tRxmMq91uG882eWBt0/RUDH05IKwLPk6Jtp2QWEEuANcCw VrySsiuz1RK7FftTYdV33+fIFhIrP2RKilWTl74AXto+mkCCMhDTdGq5N1td0Esfab/dFW3zl/iQ0 7Di5iGOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syZ1l-00000009p6y-1Dck; Wed, 09 Oct 2024 15:55:05 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syYwq-00000009o0p-1cZk for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 15:50:02 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-690404fd230so59396697b3.3 for ; Wed, 09 Oct 2024 08:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728488998; x=1729093798; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=+3zZkwU+2EpnRGguJhn2Ww+Ghmvy6uOMqwsBdHy8Row=; b=o1SM8sUi3uyBKzD0RS9Hdc1tAy5RixVodCwIsX9rKdvgZfvcxEOBbdeJaEd1+yr8O/ aeYHRfGSF2lTN2B41ZzkI7MGa6kC7Iise15c0uuYG8+KJk0PZ8BVLVa7v6puxu26hv0q 0XQP5l8AW4eCjFq1oYE+qt5dVGU7zREjE0GxDKrLDEwp2kMXd0Bqiik+l+1O1CeHINim NnzKbAZ7UY3WRfYVNkFcbWboAWsjGmNzGFQcO8PIkoZDD8H7R6UmaN/Zwmr4SFk8u6KL c9BySFciw56BJTDaxsmV4+pDEnT5VLVtKguEEXAxl2quKFRQd1dRid4pPS6usJzoBR4f 90gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728488998; x=1729093798; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+3zZkwU+2EpnRGguJhn2Ww+Ghmvy6uOMqwsBdHy8Row=; b=HvpjTaKNGCmHMCc3v6N+0/+KpGRrdCE2DcsQf0Av8atgMD7UVZBPqCwiJuxv+y2KUr VJZNbKc7RmsPfJ3TO7/zOpx8QfIUs6juRPtZSmvjUGPuCBghfBHOdzVwBmYv0XT0TGdK 9pG8WNHWRrlqY4aRkj81WjwBZkYGAh0NBJs5IDXBXUsmvifG/A0XB0LaDR3C76DLqpLY JveV7Yg81QwNSATibGuLbzNlJEDX42Si862XvvPJz07FJ81NVaIHqp3Fxgegg5ay/dke f3VJ0K5VTI517KnxmBCfpghSNecJPDH5dKWmS8xNS2ZQT3MjbI7FqXTPT5t7ifNjsZ/A 7xhw== X-Gm-Message-State: AOJu0Ywrb8NgxBfZetzCVpxK9AHx30FHYudXaXPHjDrPU1Jvv1KPAJnj FKQB2isMsd9PqZ8MSwUMhepG4FeZY9Eb4vWGkRDbusjPCrEVzGS/Zrcb0K3eIadL61zXHQmnjR/ v7A== X-Google-Smtp-Source: AGHT+IGq8S+cJ3hbYyw4prFkdU6bbiVB3Ddo6czJU4p6VUDHrgM9P6PS5yQttOYl+xpjVaNBwpEpnchtMNk= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:a05:690c:460d:b0:6db:89f0:b897 with SMTP id 00721157ae682-6e3221683d8mr69407b3.4.1728488997664; Wed, 09 Oct 2024 08:49:57 -0700 (PDT) Date: Wed, 9 Oct 2024 08:49:40 -0700 In-Reply-To: <20241009154953.1073471-1-seanjc@google.com> Mime-Version: 1.0 References: <20241009154953.1073471-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.rc0.187.ge670bccf7e-goog Message-ID: <20241009154953.1073471-2-seanjc@google.com> Subject: [PATCH v3 01/14] KVM: Move KVM_REG_SIZE() definition to common uAPI header From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Christopherson , Andrew Jones , James Houghton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_085000_470090_68D6DF22 X-CRM114-Status: GOOD ( 12.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define KVM_REG_SIZE() in the common kvm.h header, and delete the arm64 and RISC-V versions. As evidenced by the surrounding definitions, all aspects of the register size encoding are generic, i.e. RISC-V should have moved arm64's definition to common code instead of copy+pasting. Signed-off-by: Sean Christopherson Acked-by: Anup Patel --- arch/arm64/include/uapi/asm/kvm.h | 3 --- arch/riscv/include/uapi/asm/kvm.h | 3 --- include/uapi/linux/kvm.h | 4 ++++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 964df31da975..80b26134e59e 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h @@ -43,9 +43,6 @@ #define KVM_COALESCED_MMIO_PAGE_OFFSET 1 #define KVM_DIRTY_LOG_PAGE_OFFSET 64 -#define KVM_REG_SIZE(id) \ - (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) - struct kvm_regs { struct user_pt_regs regs; /* sp = sp_el0 */ diff --git a/arch/riscv/include/uapi/asm/kvm.h b/arch/riscv/include/uapi/asm/kvm.h index e97db3296456..4f8d0c04a47b 100644 --- a/arch/riscv/include/uapi/asm/kvm.h +++ b/arch/riscv/include/uapi/asm/kvm.h @@ -207,9 +207,6 @@ struct kvm_riscv_sbi_sta { #define KVM_RISCV_TIMER_STATE_OFF 0 #define KVM_RISCV_TIMER_STATE_ON 1 -#define KVM_REG_SIZE(id) \ - (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) - /* If you need to interpret the index values, here is the key: */ #define KVM_REG_RISCV_TYPE_MASK 0x00000000FF000000 #define KVM_REG_RISCV_TYPE_SHIFT 24 diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 637efc055145..9deeb13e3e01 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1070,6 +1070,10 @@ struct kvm_dirty_tlb { #define KVM_REG_SIZE_SHIFT 52 #define KVM_REG_SIZE_MASK 0x00f0000000000000ULL + +#define KVM_REG_SIZE(id) \ + (1U << (((id) & KVM_REG_SIZE_MASK) >> KVM_REG_SIZE_SHIFT)) + #define KVM_REG_SIZE_U8 0x0000000000000000ULL #define KVM_REG_SIZE_U16 0x0010000000000000ULL #define KVM_REG_SIZE_U32 0x0020000000000000ULL