From patchwork Thu Sep 9 01:38:08 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: 12482195 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 807CAC433F5 for ; Thu, 9 Sep 2021 01:43:06 +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 48ABB610E8 for ; Thu, 9 Sep 2021 01:43:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 48ABB610E8 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=8v+bXespidjAvJETqX+RNztueCdMas4fFgxhgx+G+sE=; b=zendDxTpQz0izKQXt3PBgYRQgy wJq9VcCR/EC9xoI2w1aCCo0JPa0rmI0L2kQ8+r9B8+850j3ZcEWThuT/xMNWz28Km0sugwyWxq4SB MZ+GA/wW8Pxit4UK2Vc3CvOb8MXFYysDonpLLJvMjngCW6dIQXVxHcch+cbhREldAdMhSk4GscleW NGo1LzG4udK2EJdk9OvrJ4uFfkuFRhUukCBRdoY7ff12k6Nli8ne8f286X4KcRCQvyiooaREZ6wXc BNYwkqewQqCFiRPnItLRjfL+CCnoT3jJkDXT/kvpnkG5fbgNoWgLYVRp9P7oc3PkNL9WuUbq6QlcE ZQRTMqOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO949-007wYs-Sc; Thu, 09 Sep 2021 01:41:26 +0000 Received: from mail-yb1-xb4a.google.com ([2607:f8b0:4864:20::b4a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mO91Z-007vP1-R3 for linux-arm-kernel@lists.infradead.org; Thu, 09 Sep 2021 01:38:47 +0000 Received: by mail-yb1-xb4a.google.com with SMTP id 124-20020a251182000000b005a027223ed9so388047ybr.13 for ; Wed, 08 Sep 2021 18:38:45 -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=joYYrt7hpuPfUeQcd44dEnmpKJRkC3m+olCPcRklPKY=; b=FmT4tXPeRDgw2DsrBZpZGU6PcjTlqMTB9wZqCZm9tFBuL4YGumdgIw8m9nJpGy7K2o QYsOw8LRgRYm95W4lSQlPjO7sHUsJHvmCf//Z9HkzC5WFE0ltOxtgtruZBHWU5+lyW8d tyISweHmsA2pL8jnZ1XopsISmcAGv1TGUh3i1sOmjVR+89zSpnjVbubTD5YxqU6axujR iC5Bo6uEchxMhU7sTZonLg1PKJy5nk4TN+T3O3lRQY+zvf8akm5MfKalvVWOHQh+ZZZh xa6NDR8lw9UzwQzVVyNZ4oE7mAM9CccSUMU4oq2kLeew6YO2bKG9NmIZqb2LZBM5sUaT cSog== 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=joYYrt7hpuPfUeQcd44dEnmpKJRkC3m+olCPcRklPKY=; b=ghlORAuwavh/RBMDbqOxKTiPu/rKrsE2Ln1zm6m7t50ooHr8jm/bPcEVj4aJzjoLcy Fq8xYX0VPnV6kZvRmU1I950rvQTvxj72OowP+jE8FqbmtXD/8bq5uh+c7U4o+n2DU60l zv6x3dA3oQM2uzukUJWvzpOYTaKbdoOlrqTcSrn4CrJj4n3HtQnURxm9twvkCvuix9oG jjI9RpKIL6G6pKlKOu4HSoCQy4kLXCislCBBMhRrK0BRPXOCGOcXGSjvZVXqVt9sP9Xo Dq8WYe/95Iqr6W7AkgnjVo03il6qS2l9UBCXhBQSOfG67fszwUnDkyZd9w9oM5e/bWUb aMGQ== X-Gm-Message-State: AOAM533Sy1Znt9iVTBfZEdTY6XAKyj7gUeojnKNK4FlU++I2oXC5yL+R 8HMzfGbWkMA3KyScwmmWvkGpnKo9QA0y X-Google-Smtp-Source: ABdhPJwFC/OW1Z5F2EdPKG+1rynUG9GSXEW3pl0UpRo9goR7t0bNT4MLjGR/06vsJCUHuxOMHJCWVlVpiEKi X-Received: from rananta-virt.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1bcc]) (user=rananta job=sendgmr) by 2002:a25:3894:: with SMTP id f142mr565481yba.464.1631151524424; Wed, 08 Sep 2021 18:38:44 -0700 (PDT) Date: Thu, 9 Sep 2021 01:38:08 +0000 In-Reply-To: <20210909013818.1191270-1-rananta@google.com> Message-Id: <20210909013818.1191270-9-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 08/18] KVM: arm64: selftests: Add support to disable and enable local IRQs 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_183845_940987_7C208831 X-CRM114-Status: UNSURE ( 9.02 ) 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 Add functions local_irq_enable() and local_irq_disable() to enable and disable the IRQs from the guest, respectively. Signed-off-by: Raghavendra Rao Ananta Reviewed-by: Oliver Upton Reviewed-by: Andrew Jones --- .../testing/selftests/kvm/include/aarch64/processor.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/testing/selftests/kvm/include/aarch64/processor.h b/tools/testing/selftests/kvm/include/aarch64/processor.h index 166d273ad715..b6088c3c67a3 100644 --- a/tools/testing/selftests/kvm/include/aarch64/processor.h +++ b/tools/testing/selftests/kvm/include/aarch64/processor.h @@ -184,4 +184,14 @@ static __always_inline u32 __raw_readl(const volatile void *addr) #define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c));}) #define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(__v); __v; }) +static inline void local_irq_enable(void) +{ + asm volatile("msr daifclr, #3" : : : "memory"); +} + +static inline void local_irq_disable(void) +{ + asm volatile("msr daifset, #3" : : : "memory"); +} + #endif /* SELFTEST_KVM_PROCESSOR_H */