From patchwork Thu Sep 9 01:38:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghavendra Rao Ananta X-Patchwork-Id: 12482181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CE9DC433EF for ; Thu, 9 Sep 2021 01:40:55 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0DAEB60525 for ; Thu, 9 Sep 2021 01:40:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0DAEB60525 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=edW+H0JOMdp/d/pijX5nJaTeFsqfobjqmrznhTjc0Fo=; b=F9QT4Nm5qKawD1Gm8MzvFFUOGK FSO0aZ8oM92wGedDp2OciFjGFfqQcZWfYxskkkBGazEix4Zw1gfE9ktVZcDcDT8+nP3QUt1vzSnjC MpbvB8XCJH6iRI8bgjj3guDfq7DIcmfawUou1VogRBIgh6hPEaoBaPCk78EwINuK3Q0Qlb5lAx8EH BOiT+5s140/1vB/rRnvW67jLKHzzElReysbGreyTInNewl4lUdhA5PLjeLLmHb3fVK3GQ8W7jG17R hbPLP4XSNIL9orUKE6cEpcJ/YCgBnqGkPYAK56+zqgfumAfj0X27oxfyhZbTTltyQ1akwGhtE1Tnd BzaTmw4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO929-007vZj-K6; Thu, 09 Sep 2021 01:39:21 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO91Q-007vMb-4H for linux-arm-kernel@lists.infradead.org; Thu, 09 Sep 2021 01:38:37 +0000 Received: by mail-yb1-xb49.google.com with SMTP id j9-20020a2581490000b02905897d81c63fso407668ybm.8 for ; Wed, 08 Sep 2021 18:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zNHqAFnuHiggwZ7jn9N18KxilmXmaHVrWak3lSk+d74=; b=rKFntGWT7Zlr1j69UYRUvBr32BT0o9bmx5mTs/dXAaJ7tGkNGtdvXB7ckiyofZChKV 7n52lUMs/NChF+8iAfWGVFmty6jb+kLonv/JDmnQso092hq5b3v+Rn6dR2u9pNlcJb32 vyDtjMYhsYXNh/ccaY792PP4q4YjoqfVydlQw2NSiNBjJlVPLuidRcTObpascm5hLwn3 x8aviO8LNf3odytaZJ7XuCObuChS5xmrQQIOr/xsJeiFeAvbvOMUF3HZBZV0Zp5KrxTi 9xnbF76qFJKkIoIsC7tdccHakdVT2nlJz/kVIfoAIwNxLcl0JHNmxQ0Th6vOjH+sHCwy lJTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zNHqAFnuHiggwZ7jn9N18KxilmXmaHVrWak3lSk+d74=; b=FnVXQoCzXE4zFjJBA+XcAyRZ+j5wAbEIJYpNh6bXKCu++MBG/ZtXebetJ+LVDO+ZH/ zXxcwd7taOgtq6ICfMJnbFHRD3o0C3r9pogxL6zFbHLDqa2hxPJfSgFZMIzxFgqQmSGy +r/v7RK85WhO8BMYuUBFCv4i6bRGdJ7mV+88l7dGxVcoVtZn1Ocq08F0mKhIiqUAwcAg xufd4wjIRu8FO64a2a6f9uXEQNzMJEfOaDUttkLqaRRzFX7D5Khl2xvON3XyuSUchIgS QawjEgzYEx+dw93khPnQJ93lOp4O7rUwkMaml9HTAkiPUDBaVuzlo+HuD9opBFyAeN90 Azjw== X-Gm-Message-State: AOAM5306cP0VlyPpES7JNnHmAeKKzQDW9ow5AiN7tiEfOcJOiMTi5F8D Cz+T3MiT6iPfcc+UVSfnOemypRnH8q7u X-Google-Smtp-Source: ABdhPJzqGHIW5BlqjxrpUF6cFXd1RySHNQzV5SgkIh3LB+LBsAvRqWs0V+o2D2lg90iac2o/nK8DBUg+bdAv X-Received: from rananta-virt.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1bcc]) (user=rananta job=sendgmr) by 2002:a25:1845:: with SMTP id 66mr543521yby.396.1631151514456; Wed, 08 Sep 2021 18:38:34 -0700 (PDT) Date: Thu, 9 Sep 2021 01:38:04 +0000 In-Reply-To: <20210909013818.1191270-1-rananta@google.com> Message-Id: <20210909013818.1191270-5-rananta@google.com> Mime-Version: 1.0 References: <20210909013818.1191270-1-rananta@google.com> X-Mailer: git-send-email 2.33.0.153.gba50c8fa24-goog Subject: [PATCH v4 04/18] KVM: arm64: selftests: Introduce ARM64_SYS_KVM_REG From: Raghavendra Rao Ananta To: Paolo Bonzini , Marc Zyngier , Andrew Jones , James Morse , Alexandru Elisei , Suzuki K Poulose Cc: Catalin Marinas , Will Deacon , Peter Shier , Ricardo Koller , Oliver Upton , Reiji Watanabe , Jing Zhang , Raghavendra Rao Anata , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210908_183836_234907_80A62115 X-CRM114-Status: UNSURE ( 9.84 ) X-CRM114-Notice: Please train this message. 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the inclusion of sysreg.h, that brings in system register encodings, it would be redundant to re-define register encodings again in processor.h to use it with ARM64_SYS_REG for the KVM functions such as set_reg() or get_reg(). Hence, add helper macro, ARM64_SYS_KVM_REG, that converts SYS_* definitions in sysreg.h into ARM64_SYS_REG definitions. Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Andrew Jones --- .../selftests/kvm/include/aarch64/processor.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tools/testing/selftests/kvm/include/aarch64/processor.h index bed4ffa70905..ac8b63f8aab7 100644 --- a/tools/testing/selftests/kvm/include/aarch64/processor.h +++ b/tools/testing/selftests/kvm/include/aarch64/processor.h @@ -26,6 +26,20 @@ #define ID_AA64DFR0_EL1 3, 0, 0, 5, 0 +/* + * ARM64_SYS_KVM_REG(sys_reg_id): Helper macro to convert + * SYS_* register definitions in sysreg.h to use in KVM + * calls such as get_reg() and set_reg(). + */ +#define ARM64_SYS_KVM_REG(sys_reg_id) \ +({ \ + ARM64_SYS_REG(sys_reg_Op0(sys_reg_id), \ + sys_reg_Op1(sys_reg_id), \ + sys_reg_CRn(sys_reg_id), \ + sys_reg_CRm(sys_reg_id), \ + sys_reg_Op2(sys_reg_id)); \ +}) + /* * Default MAIR * index attribute