Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp268982lqg; Thu, 11 Apr 2024 02:07:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWL8St6dooN203GmmwzyiratdQO5oEsXAntO6ZSsJiW89QiET1OJqMDdAmkLZoX3mQ4marRQYZceYPdjIk/H5bMwQu54bqjF19e1jNwXQ== X-Google-Smtp-Source: AGHT+IH+Ys0mOLqao7lj1g3mqbExBCTm+/V5KH7cGQ465N1X8Oq4JLMa6lPOhGwVNwWBUU8P8zvk X-Received: by 2002:a05:6a00:10c7:b0:6ed:825b:30c0 with SMTP id d7-20020a056a0010c700b006ed825b30c0mr2580215pfu.15.1712826432228; Thu, 11 Apr 2024 02:07:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712826432; cv=pass; d=google.com; s=arc-20160816; b=RPPE9E4FZNQKiGeB9XoEKgV5dGgeP3SR6NggAdGMnrzPxoMAYUf9Rgoc+Web2oQv80 5pWSHK5wjXdlSvAKLdG5NqFG5W2e2vRU4VhxvqF4lxRUqol70j9Wc2s5N2fuvapRpOuK djjr+BmTWVj82/JdSuTq5mjwixUrhzuIxMEaYLvuA2TuqjzecLQG7vUU+1cYcGx8Cspz pW7zu4Dd+fuRtOM3m6P65B5Orys2+7qrzY825hpM1DzNevnguAf985ZyPKzD2b6Cx5qy oYZAI4ct88Mmufbyfr+si4wEuy8ryhWlV2YzjhqSB1PEkT4UZh9LiOlOwxDQD76+S6jx p6zw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qo8k+jtku3GLugoqX/2jDzvY4YtbrVgAtt9TNzdVCZA=; fh=mq3/i4+FG5sw3yhGR4Nw0jQcQCHoeFccmvscGiFtEc8=; b=z638vglD4TPYuPzK+bWH0U4x0I0z1XvK0WeVjqwpPrj8v2T0iCdKgIwxoTAh3FhC1Q TRv2s30O/FPmEKRG/Bx98KmM/FqKh8p+y4l7ww6kSSRFD0GhaYngeu6SwlJxgRr1ovCT Duj036mCz0iNvkQIs5r6IW0XKr6Yyy0qw/kOCYIfcp5iUHtK7P2XVwyBdIx5V4YZQlNb siGKtX61knciFr0zyUxywq5KN7hsA9vz3+kpfltElmlS2Wtz7SlZsbCPgvkpm477dgaj ZEvoaXYEJqyzQVOw0+X1+PUOeMeu+qNxucGQ5yKqOnnbpIPF0hqiXyRYRalxH9MuR8mH fIKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="OmEZYaW/"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-140137-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140137-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a15-20020aa7864f000000b006eb4c57bf20si1064587pfo.139.2024.04.11.02.07.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 02:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-140137-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ventanamicro.com header.s=google header.b="OmEZYaW/"; arc=pass (i=1 spf=pass spfdomain=ventanamicro.com dkim=pass dkdomain=ventanamicro.com); spf=pass (google.com: domain of linux-kernel+bounces-140137-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-140137-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DD1182818ED for ; Thu, 11 Apr 2024 09:07:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 031B2142E94; Thu, 11 Apr 2024 09:06:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b="OmEZYaW/" Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 659301442FF for ; Thu, 11 Apr 2024 09:06:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712826415; cv=none; b=d3LyK10CDryROSiQcJyI3w7tPIvAQ4bBzqpwYfoPfprbCPP6Et25NERZMxFCR7sRhqcCrZB3gyOUVwc0IK9X9vewQmaY+ZujOA1peTefXZj5x1dWZ7iFa59aJ8FkJslXBJfgtpx+uB67Vis2jLp6BA1UaINNwBI9U6GneX73m9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712826415; c=relaxed/simple; bh=5R5HClKDyvVMYt+Dlj2lOG3qD5DL07WR9z83rlZrbpc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p2vBKIYjY0yB9rHt25Ycrd+JxKJQw8hSYo4aDFjOeUDFCsKjqXeeJ0vDXMcsl2nwqhsEY/9pFL/PSEZpxF/vN4+lQS1dBB0fAllvdmEaAjfV+Sg295hfE/1PVFREnSJopoEDyvadhnFe68mPe/YQ1pO1ibemkvAckhMeEbVUM24= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com; spf=pass smtp.mailfrom=ventanamicro.com; dkim=pass (2048-bit key) header.d=ventanamicro.com header.i=@ventanamicro.com header.b=OmEZYaW/; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ventanamicro.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6ecf8ebff50so454464b3a.1 for ; Thu, 11 Apr 2024 02:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1712826413; x=1713431213; darn=vger.kernel.org; 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=qo8k+jtku3GLugoqX/2jDzvY4YtbrVgAtt9TNzdVCZA=; b=OmEZYaW/sKgFW0YQYvdshEMMM1NnMXMmgW3DjqLj9zdL1XlzFieKuTNlusDGzDcYHV XtHXqJfzoTzXq7Km0FZEi2NHebmkiwwv1Xd3R+lm3Y82wBTlfM4v8TVadL3DQs4UnK7K Psj0Sdc8wUnPZ2zFKNmNS8nhjG+zVL9yeeLc2ZYWGZqk8/QOwgquQrQbWPeiV6g23/a+ Dpx/rzYL5Cr/09unDXEjOG2qG3frfG3PF+E/S7QlT0ReWd1Yo834Qw34lgeqeW7Xjq7O fyfUExSiuszOtU6t6WhlqaVqVz9pwHGgQ+agM17bAgmn56sT/uUNc4IyMdMngRF/2OYT PGMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712826413; x=1713431213; 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=qo8k+jtku3GLugoqX/2jDzvY4YtbrVgAtt9TNzdVCZA=; b=T+Imr6Jxulp3G/PnBsHWHG2TuP37fdKKdO8kLElCKKxZaFA5y2sPkJmdNVMAhXYr08 FMNFLr5jUmeBqVzx1/G4XOoqDGc3ito8u0JZjpm73EppuW0PsNF97V7dWZuBCXUTHRPW vX/NHfFsaNKBfrshdagl0UigqQCXzDbWInH2W9qflFiIFBpgw9hAkFOZoc0oi0P56KcA sTWbKsatmGzwOvNkuoqJ685T68XHnWJOKITwswR6Iy5MKTvxAkoglvOStSbpWu2dRtYw urDauIUa3lmROouj67gzPR6wzLc09XqbNM451VxjejLXSD/NIZDgwVbMNum7JZXefsgW sWnA== X-Forwarded-Encrypted: i=1; AJvYcCUIGYwswIsbAIXz8BT/yBoGK6S0NMCpWk3l694BIQH/2Qu9ts95XbJOogOSaLm6qIJ1rj0rebmIlyYuiM6SDDyKs+T3jO/0WJDG6Udh X-Gm-Message-State: AOJu0YzLAhtk/RNSY+b5b4XUzFAg2xzB+JgN/Jy5xUUYzkoJKupX0gq2 gw1aIWrri9YsFrDmew+UZe37yHYxQO60yt89yPAs+cSjqdXgD1nDReinWoNHCd4= X-Received: by 2002:a05:6a00:10c7:b0:6ed:825b:30c0 with SMTP id d7-20020a056a0010c700b006ed825b30c0mr2579203pfu.15.1712826412404; Thu, 11 Apr 2024 02:06:52 -0700 (PDT) Received: from anup-ubuntu-vm.localdomain ([171.76.82.118]) by smtp.gmail.com with ESMTPSA id e21-20020aa78c55000000b006e729dd12d5sm816738pfd.48.2024.04.11.02.06.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 02:06:52 -0700 (PDT) From: Anup Patel To: Palmer Dabbelt , Paul Walmsley Cc: Atish Patra , Andrew Jones , Anup Patel , kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Anup Patel Subject: [PATCH 1/2] RISC-V: KVM: Share APLIC and IMSIC defines with irqchip drivers Date: Thu, 11 Apr 2024 14:36:38 +0530 Message-Id: <20240411090639.237119-2-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240411090639.237119-1-apatel@ventanamicro.com> References: <20240411090639.237119-1-apatel@ventanamicro.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit We have common APLIC and IMSIC headers available under include/linux/irqchip/ directory which are used by APLIC and IMSIC irqchip drivers. Let us replace the use of kvm_aia_*.h headers with include/linux/irqchip/riscv-*.h headers. Signed-off-by: Anup Patel --- arch/riscv/include/asm/kvm_aia_aplic.h | 58 -------------------------- arch/riscv/include/asm/kvm_aia_imsic.h | 38 ----------------- arch/riscv/kvm/aia.c | 2 +- arch/riscv/kvm/aia_aplic.c | 2 +- arch/riscv/kvm/aia_device.c | 2 +- arch/riscv/kvm/aia_imsic.c | 2 +- 6 files changed, 4 insertions(+), 100 deletions(-) delete mode 100644 arch/riscv/include/asm/kvm_aia_aplic.h delete mode 100644 arch/riscv/include/asm/kvm_aia_imsic.h diff --git a/arch/riscv/include/asm/kvm_aia_aplic.h b/arch/riscv/include/asm/kvm_aia_aplic.h deleted file mode 100644 index 6dd1a4809ec1..000000000000 --- a/arch/riscv/include/asm/kvm_aia_aplic.h +++ /dev/null @@ -1,58 +0,0 @@ -/* 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 diff --git a/arch/riscv/include/asm/kvm_aia_imsic.h b/arch/riscv/include/asm/kvm_aia_imsic.h deleted file mode 100644 index da5881d2bde0..000000000000 --- a/arch/riscv/include/asm/kvm_aia_imsic.h +++ /dev/null @@ -1,38 +0,0 @@ -/* 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 -#include - -#define IMSIC_MMIO_PAGE_SHIFT 12 -#define IMSIC_MMIO_PAGE_SZ (1UL << IMSIC_MMIO_PAGE_SHIFT) -#define IMSIC_MMIO_PAGE_LE 0x00 -#define IMSIC_MMIO_PAGE_BE 0x04 - -#define IMSIC_MIN_ID 63 -#define IMSIC_MAX_ID 2048 - -#define IMSIC_EIDELIVERY 0x70 - -#define IMSIC_EITHRESHOLD 0x72 - -#define IMSIC_EIP0 0x80 -#define IMSIC_EIP63 0xbf -#define IMSIC_EIPx_BITS 32 - -#define IMSIC_EIE0 0xc0 -#define IMSIC_EIE63 0xff -#define IMSIC_EIEx_BITS 32 - -#define IMSIC_FIRST IMSIC_EIDELIVERY -#define IMSIC_LAST IMSIC_EIE63 - -#define IMSIC_MMIO_SETIPNUM_LE 0x00 -#define IMSIC_MMIO_SETIPNUM_BE 0x04 - -#endif diff --git a/arch/riscv/kvm/aia.c b/arch/riscv/kvm/aia.c index a944294f6f23..8ea51a791371 100644 --- a/arch/riscv/kvm/aia.c +++ b/arch/riscv/kvm/aia.c @@ -10,12 +10,12 @@ #include #include #include +#include #include #include #include #include #include -#include struct aia_hgei_control { raw_spinlock_t lock; diff --git a/arch/riscv/kvm/aia_aplic.c b/arch/riscv/kvm/aia_aplic.c index b467ba5ed910..da6ff1bade0d 100644 --- a/arch/riscv/kvm/aia_aplic.c +++ b/arch/riscv/kvm/aia_aplic.c @@ -7,12 +7,12 @@ * Anup Patel */ +#include #include #include #include #include #include -#include struct aplic_irq { raw_spinlock_t lock; diff --git a/arch/riscv/kvm/aia_device.c b/arch/riscv/kvm/aia_device.c index 0eb689351b7d..308b3bbede33 100644 --- a/arch/riscv/kvm/aia_device.c +++ b/arch/riscv/kvm/aia_device.c @@ -8,9 +8,9 @@ */ #include +#include #include #include -#include static void unlock_vcpus(struct kvm *kvm, int vcpu_lock_idx) { diff --git a/arch/riscv/kvm/aia_imsic.c b/arch/riscv/kvm/aia_imsic.c index e808723a85f1..0a1e859323b4 100644 --- a/arch/riscv/kvm/aia_imsic.c +++ b/arch/riscv/kvm/aia_imsic.c @@ -9,13 +9,13 @@ #include #include +#include #include #include #include #include #include #include -#include #define IMSIC_MAX_EIX (IMSIC_MAX_ID / BITS_PER_TYPE(u64)) -- 2.34.1