From patchwork Thu Jun 15 07:33:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 108336 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp470969vqr; Thu, 15 Jun 2023 01:16:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5qrMjBLVFZxLzPBhN0Tgw8FQloBpZcLm7YGEfpPg5eYUwn+z+xn/7RENbBGjx8IHqWzYHi X-Received: by 2002:a17:907:2d0f:b0:965:6075:d0e1 with SMTP id gs15-20020a1709072d0f00b009656075d0e1mr18031665ejc.72.1686816960104; Thu, 15 Jun 2023 01:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686816960; cv=none; d=google.com; s=arc-20160816; b=h04gD4VaJt2nwoheKK++KpIMAIWYqQxcq6zvR7BlaybtZRl9fYsbnS/wk8wU2umF56 iu/fBK5d0dZ6bTlxNrV+weHmz8RsU9PrN3D5BRlXl682XhrPtg6/CXVx8fxZY+1FqFhG 5xet39ryAFm6ufugfMKXip9enI+nCJUyw+kwgQgEuYym252kSMA/tUvXGZ3IEutzeVuq jcCgKC6jCcM/Fft7l8yEZccY8fXeHlMfR7/2RYAdcOYyh5nWkcMc0c0j5zy84f6gQuOP +2jewbEUvkjbyJqGf9b0mSoM3j54BkCg20YPINPkiBxRLo78+ZNQda/wiviYBrbbozSt b8Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=n5vQwpyR3/1vG/MlBdXYEenCvwMIo2s7ZFYf5nDLaQE=; b=SGndjMFFBe4dGUPW7iW+oYpZhi4+ZRTtFxy2Cm2P73iMwd7MbxzrlkAW6rt49ZhoZ/ lOfzhrb5zWn3hmjYQ09JRAMAYVZfgeqhdGbu5D0LreDo+3fFssigGtgcV90mGnu7NZr5 bK/mMxQcG5RTHyN5+qiBQGZeJmdrMwQf588wN7ZTYPwp7pPFGjFjA/SKiFxKeyA9fr0y 5p0ypOMbojereVnXf22mEpZEF+DjXqi5brI3CxFSxAzg72yTmyANTVgVWEkdJkyAAx3w ZY7U+nKCJA0HuOfIWG3YAg8YNC3rxHADFmTsXmMdOw8/Y6Ai2oFNtWAmjK2blfiNebdN cY3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Wzl1Ykl8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a17090633d500b00966228ee758si8368575eja.467.2023.06.15.01.15.35; Thu, 15 Jun 2023 01:16:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Wzl1Ykl8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244989AbjFOHfi (ORCPT + 99 others); Thu, 15 Jun 2023 03:35:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244886AbjFOHes (ORCPT ); Thu, 15 Jun 2023 03:34:48 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BEF12972 for ; Thu, 15 Jun 2023 00:34:13 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1b02fcde49aso43643595ad.0 for ; Thu, 15 Jun 2023 00:34:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1686814452; x=1689406452; 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=n5vQwpyR3/1vG/MlBdXYEenCvwMIo2s7ZFYf5nDLaQE=; b=Wzl1Ykl8eOwlw+4AW6ewSJO4VQKgM5N7dvFdKlOR/mSpdA9DgVny251fYxrcO4DFzv MP/TXjrazhukelqOeBJ3uKasUkan0XMgyw3oWWGVRZYofoYEs1lSpHrd/oDdvSlpxeA8 gR/9L6uWDIbVgO7ai5ZqsjIKYPkf2Sl7MZVmYuwRXya1nKZPH76w0/i542oR8dqr8uN6 qke9O+CV/kW5+Mw9EwbSRsqKtQPbAWRxkqgr9thgAWqyOmOR6vJaCVocIISUHTzJXtOz WW0CJCPdeVFlmV7TE4bDABAR5DULT95/FIy3T/RsQtvRwytg6TQ+38dJWHV6vhKdF6vo Fjug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686814452; x=1689406452; 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=n5vQwpyR3/1vG/MlBdXYEenCvwMIo2s7ZFYf5nDLaQE=; b=Udyppbl2sAMYrZ+pbAYYBit6qvbvDEsO45c4/vbbuLpiMjC2ksdPVQo7LLr0Q4mdAq QmkDjXlPYZiYVmbUnRzqF+NFIVjUdoQob6JyTxnqL/w+RCcM1XxqnCijo87oP5c4/z84 6HojEI/psy1sDh0FH/QUYU0Cpps/GbASxLb2qe4wCCXZiqqvd6INlV0v+8BriEphAg8H iBDL7NCXr7dLv68McUE/OHVnXup8KnU6tOgyuvSxCVdY4yr+kj6A+S05slDqcLrrXdKW aCBI7OGWF78m2AfrHtu3E6vbK1lwGJqrqttJedhkBSZIpPJ4V8d6y83gbgaBxhLA9ABN lPGg== X-Gm-Message-State: AC+VfDxlve6L3Gsb15wgjZWhVL1sQ3FAmqUZWV+6gBvn96vAlRR1cfg1 of1TLvwDCcLOo0R0k5f7fSyIRQ== X-Received: by 2002:a17:903:54:b0:1af:cf34:a645 with SMTP id l20-20020a170903005400b001afcf34a645mr10978937pla.21.1686814452521; Thu, 15 Jun 2023 00:34:12 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([106.51.83.242]) by smtp.gmail.com with ESMTPSA id ji1-20020a170903324100b001b016313b1dsm8049855plb.86.2023.06.15.00.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 00:34:12 -0700 (PDT) From: Anup Patel To: Paolo Bonzini , Atish Patra Cc: Palmer Dabbelt , Paul Walmsley , Andrew Jones , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel , Atish Patra Subject: [PATCH v3 03/10] RISC-V: KVM: Add APLIC related defines Date: Thu, 15 Jun 2023 13:03:46 +0530 Message-Id: <20230615073353.85435-4-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230615073353.85435-1-apatel@ventanamicro.com> References: <20230615073353.85435-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768755781107426645?= X-GMAIL-MSGID: =?utf-8?q?1768755781107426645?= We add APLIC related defines in a separate header so that different parts of KVM code can share it. Once AIA drivers are merged will have a common APLIC header shared by both KVM and IRQCHIP driver. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- arch/riscv/include/asm/kvm_aia_aplic.h | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 arch/riscv/include/asm/kvm_aia_aplic.h diff --git a/arch/riscv/include/asm/kvm_aia_aplic.h b/arch/riscv/include/asm/kvm_aia_aplic.h new file mode 100644 index 000000000000..6dd1a4809ec1 --- /dev/null +++ b/arch/riscv/include/asm/kvm_aia_aplic.h @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2021 Western Digital Corporation or its affiliates. + * Copyright (C) 2022 Ventana Micro Systems Inc. + */ +#ifndef __KVM_RISCV_AIA_IMSIC_H +#define __KVM_RISCV_AIA_IMSIC_H + +#include + +#define APLIC_MAX_IDC BIT(14) +#define APLIC_MAX_SOURCE 1024 + +#define APLIC_DOMAINCFG 0x0000 +#define APLIC_DOMAINCFG_RDONLY 0x80000000 +#define APLIC_DOMAINCFG_IE BIT(8) +#define APLIC_DOMAINCFG_DM BIT(2) +#define APLIC_DOMAINCFG_BE BIT(0) + +#define APLIC_SOURCECFG_BASE 0x0004 +#define APLIC_SOURCECFG_D BIT(10) +#define APLIC_SOURCECFG_CHILDIDX_MASK 0x000003ff +#define APLIC_SOURCECFG_SM_MASK 0x00000007 +#define APLIC_SOURCECFG_SM_INACTIVE 0x0 +#define APLIC_SOURCECFG_SM_DETACH 0x1 +#define APLIC_SOURCECFG_SM_EDGE_RISE 0x4 +#define APLIC_SOURCECFG_SM_EDGE_FALL 0x5 +#define APLIC_SOURCECFG_SM_LEVEL_HIGH 0x6 +#define APLIC_SOURCECFG_SM_LEVEL_LOW 0x7 + +#define APLIC_IRQBITS_PER_REG 32 + +#define APLIC_SETIP_BASE 0x1c00 +#define APLIC_SETIPNUM 0x1cdc + +#define APLIC_CLRIP_BASE 0x1d00 +#define APLIC_CLRIPNUM 0x1ddc + +#define APLIC_SETIE_BASE 0x1e00 +#define APLIC_SETIENUM 0x1edc + +#define APLIC_CLRIE_BASE 0x1f00 +#define APLIC_CLRIENUM 0x1fdc + +#define APLIC_SETIPNUM_LE 0x2000 +#define APLIC_SETIPNUM_BE 0x2004 + +#define APLIC_GENMSI 0x3000 + +#define APLIC_TARGET_BASE 0x3004 +#define APLIC_TARGET_HART_IDX_SHIFT 18 +#define APLIC_TARGET_HART_IDX_MASK 0x3fff +#define APLIC_TARGET_GUEST_IDX_SHIFT 12 +#define APLIC_TARGET_GUEST_IDX_MASK 0x3f +#define APLIC_TARGET_IPRIO_MASK 0xff +#define APLIC_TARGET_EIID_MASK 0x7ff + +#endif