From patchwork Wed Sep 11 20:41:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13801082 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 BBE43EE57D7 for ; Wed, 11 Sep 2024 20:44:53 +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=+KcQL/bdCq18fS3rSOcZm5DU7Hi8Axoom7HVevkC6r4=; b=26EX3ARDMzlETzT0XSInhQpbCW 4BuzKioOvq0rbcUciE/W8QY7sBTCHKJgoFENJFsaO0XLDKNzvSzVLy96/JziYqTRJ9Qq8d8bqjs9t NsPwl9yC88sH9NyaUUB+AhXw5U9gITtGcLnwE04dx966EWRtHtWJ+cscBbxn2izhgS8ZPWCW2EoQ7 iNhYPImgIUYpVZXj8G6shxvOQi5uORqSA+X1KPwZKacFd2fv8ms0v3arDOpvDwYT7qeb8vdqzNKS7 QJLKYxPoV+e6U/+n4+RnzxJMityIZkeorozLfMovlPMrM0UW/G6gzMXL656+HcOH3vfmRUrocidAX G2ToF/AQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soUCh-0000000Axsc-0JmQ; Wed, 11 Sep 2024 20:44:43 +0000 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soUAR-0000000AwuI-1w1I for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 20:42:25 +0000 Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-2053f4938c7so4338065ad.2 for ; Wed, 11 Sep 2024 13:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726087342; x=1726692142; 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=+KcQL/bdCq18fS3rSOcZm5DU7Hi8Axoom7HVevkC6r4=; b=4A90e3VXm5OyXqgqySu2o+SCx3o33im9iEftzf4ceFp4QiHCJUg7BOzLFqxXv3yU2T xGQCIA4wUuRDj3RpAr6hpTwANuVXm91jOC9UPm/CAA2XuZYvur+i6aIY60Xi2uVbA+vg OoO5BMJNMf2ZrQmjKsGOpn2NvoV8xnft40+0rHtx2B0jVQU6AfONa4UWShHyDZQ6QEF7 4e9f3kMegqBXqzgZ07+H7tgi/zOeuPLn1YytGwFLs83ktZE+WxT4VKhgPw+caIFWxkdT VJYeDQWNgtH7POQ+4pB3vaP0CiU/IN3HUH+Sla9R2irUYR5OEWej/u8wZiLXTy9rx97L Q0dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726087342; x=1726692142; 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=+KcQL/bdCq18fS3rSOcZm5DU7Hi8Axoom7HVevkC6r4=; b=cjbMB3oPycvZkfhEqpGkUThxt58M9evtdaBH98GxkgcQHLja3OzWdvNiQ36s7/3mBY j/g1iKCsMJXLsTUsEq0X04wAdsunVev4KyONJqLwYaYUN8MjcLPnC6camyug9fWoGtfR /eZI0mz/9Fg6S/n21jjGlUvwgCER9IdjS9X1TMB94vwJL6PNxdiktENnCh0nw8HuGq/b nCdJ+dmgPe/5C9xHKASMYZ5oc46clvkJc0WD/CpL3v3KWsFD6o2ARlZZkSwqt5Kq61Kg a+bsujvlU9I6/Ls2HIupRLN0c5KsZfDD3ZXEqWt4JFo3kMb9WVpPryjrjfmqGKTvP+1B xnYA== X-Gm-Message-State: AOJu0YxKWhVymS2CmvdJA9v9YlDAMJjAMLkYXvMJgJkVNr86UMnZHBkB tQUhq8HQABfvmMXkidVcdRploUcWvuBAKunT6mKwVG9cN3NsiLBm+RSLzgX6QEp5cz56W/HRww4 KEw== X-Google-Smtp-Source: AGHT+IEO5NwWx0FrDp8QKSLHZru3Ive0KlYcZGHHsB7iPFbn3vSIzuOoVV6CHwgKSaGOFRDtrL7V2ub0u3g= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:f682:b0:202:4712:e84c with SMTP id d9443c01a7336-2076e3f784bmr227705ad.6.1726087342373; Wed, 11 Sep 2024 13:42:22 -0700 (PDT) Date: Wed, 11 Sep 2024 13:41:46 -0700 In-Reply-To: <20240911204158.2034295-1-seanjc@google.com> Mime-Version: 1.0 References: <20240911204158.2034295-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog Message-ID: <20240911204158.2034295-2-seanjc@google.com> Subject: [PATCH v2 01/13] KVM: Move KVM_REG_SIZE() definition to common uAPI header From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , 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 , James Houghton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_134223_522441_F99994A4 X-CRM114-Status: GOOD ( 12.75 ) 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 --- 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