From patchwork Fri Jun 10 04:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mayuresh Chitale X-Patchwork-Id: 1641569 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=SCnj4+sT; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=iZEbRsRU; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LK7nH5Flmz9s1l for ; Fri, 10 Jun 2022 14:50:27 +1000 (AEST) 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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Kk7LrjKkjbouV31WYnonbPve3jonxMUy6KpVh4oCOUc=; b=SCnj4+sT0GJETk isNAE9uB1QMM9ZwZGRHjIQa7DBfzg26MBEKgAZiowmLkMgdv3mvw1WHWehKckzrtN0f75MuRurmkM EcAbfZOabmcAPOCJGzb2wz/iq5SNhv6mwAaQmPcy1oBJI/xw0sv2gtGjx3TG9IB4X7UA+ne70L6g1 hUXcoWB5ysDEQXKu15Krv/X1cGUFoHv4hE3CKWCalekareTFxepvvPGtET+enY6wq+xdFObQG/kLy yUlLWjcNjxsvDQxli9/NWVzSYTPXe5Yz3iOQK8O48fNsA6qtDngxaiiN242rGZKyO3OXHuHO4Im3Y tJ0RHxyf5RX8i2zgjxRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzWax-005q6m-3l; Fri, 10 Jun 2022 04:50:03 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzWar-005q4R-KA for opensbi@lists.infradead.org; Fri, 10 Jun 2022 04:50:01 +0000 Received: by mail-pf1-x434.google.com with SMTP id c196so22883424pfb.1 for ; Thu, 09 Jun 2022 21:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vvLDjEZbklItnSqoNbbKpXS0XJvFFe82GyKXH/L8CAg=; b=iZEbRsRUAEv/D4PKnCWRfnjFpN9Tsv0JfDVasASoEmB8/Eiq2QyouywAb7e8e4y08s WqZntptFYGiYr727QZtB9wIfQ0U+i4HlDQZkBQ+sijWVdGNVjfJprRGvxWviffDLlcF2 dlMcn+fFlY0zg6zhg5HFRGbFEHUjfOC7KxX+FETspjObXy6TCK96dvXjrsNb+l21/HHP q2TkyNjoAD4M/ZSCtzYq5xDw2lqETjmVfi043zOVT+BCq2LYG0mtzhDAIRWGGKPbHnga gP6SnTGUeKtOItEU0/COjuurW65pVpjwHC0WgLNZo9ROCI/JpH03f0c6JmQzm4+i1zle jx3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=vvLDjEZbklItnSqoNbbKpXS0XJvFFe82GyKXH/L8CAg=; b=vrmSsuGob19SItmsx112BF82vPKBxhBetUJDnnnHeMeOi501ma85whVGZcnvwAGpLK ab0xBBo5MxUP2fUnvxqvuRm2K32qrp9pBIkXIli8dAxXa7YVwpyC+7uaP4IUquSVDy2w D5KAiZFVEfWrQj9hOaqGhrXl5f054Wygu3ZKpnfEAXlZbNb/RVWZcfD2TgRm4wWSmjpn 9VS1nVj/T5jPw4IRHW4DX1O1GBAik/B8CSx94xh8NYdLvhbV7AM6DVJHYrlOzLmOJqZq pb6HdPH0XJD1LAUD1PVqdbqPxpzQ3AG1RglJ5rhDjmc15T+BsLcyej8aMk8x7LJs8T8p s5Gg== X-Gm-Message-State: AOAM532h5p7xS4vigPrSoIExloRg5+0JUx4//0R8QZfx9/T/K3u5gU5r gr9Tvp1ZanSUfbrM+HkihW7ZddnJJEWVfw== X-Google-Smtp-Source: ABdhPJwTxyt3oaDytGS94uwbYc+Vca0TeWlKIMMWR7HlZVcv6SzCScHskXUmY/UFTkucmU4O/FBmhw== X-Received: by 2002:a65:64d9:0:b0:3fc:5285:5d63 with SMTP id t25-20020a6564d9000000b003fc52855d63mr37730327pgv.456.1654836594679; Thu, 09 Jun 2022 21:49:54 -0700 (PDT) Received: from ThinkPad-T490.dc1.ventanamicro.com ([122.162.223.121]) by smtp.googlemail.com with ESMTPSA id x191-20020a6386c8000000b003fd9b8b865dsm10742821pgd.0.2022.06.09.21.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jun 2022 21:49:54 -0700 (PDT) From: Mayuresh Chitale To: opensbi@lists.infradead.org Cc: Mayuresh Chitale Subject: [PATCH] platform: generic: add overrides for vendor extensions Date: Fri, 10 Jun 2022 10:19:20 +0530 Message-Id: <20220610044920.547047-1-mchitale@ventanamicro.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220609_214957_703879_59A6B1E7 X-CRM114-Status: GOOD ( 11.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Allow the vendor_ext_check and vendor_ext_provider APIs of the generic platform to be overridden by other platforms Signed-off-by: Mayuresh Chitale --- platform/generic/include/platform_override.h | 7 ++++++ platform/generic/platform.c | 25 ++++++++++++++++++++ 2 files changed, 32 insert [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:434 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Allow the vendor_ext_check and vendor_ext_provider APIs of the generic platform to be overridden by other platforms Signed-off-by: Mayuresh Chitale Reviewed-by: Anup Patel --- platform/generic/include/platform_override.h | 7 ++++++ platform/generic/platform.c | 25 ++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h index 4af8754..e55da25 100644 --- a/platform/generic/include/platform_override.h +++ b/platform/generic/include/platform_override.h @@ -11,6 +11,7 @@ #define __PLATFORM_OVERRIDE_H__ #include +#include struct platform_override { const struct fdt_match *match_table; @@ -21,6 +22,12 @@ struct platform_override { void (*early_exit)(const struct fdt_match *match); void (*final_exit)(const struct fdt_match *match); int (*fdt_fixup)(void *fdt, const struct fdt_match *match); + int (*vendor_ext_check)(long extid, const struct fdt_match *match); + int (*vendor_ext_provider)(long extid, long funcid, + const struct sbi_trap_regs *regs, + unsigned long *out_value, + struct sbi_trap_info *out_trap, + const struct fdt_match *match); }; #endif diff --git a/platform/generic/platform.c b/platform/generic/platform.c index 7651273..bf93af6 100644 --- a/platform/generic/platform.c +++ b/platform/generic/platform.c @@ -168,6 +168,29 @@ static int generic_final_init(bool cold_boot) return 0; } +static int generic_vendor_ext_check(long extid) +{ + if (generic_plat && generic_plat->vendor_ext_check) + return generic_plat->vendor_ext_check(extid, + generic_plat_match); + + return 0; +} + +static int generic_vendor_ext_provider(long extid, long funcid, + const struct sbi_trap_regs *regs, + unsigned long *out_value, + struct sbi_trap_info *out_trap) +{ + if (generic_plat && generic_plat->vendor_ext_provider) { + return generic_plat->vendor_ext_provider(extid, funcid, regs, + out_value, out_trap, + generic_plat_match); + } + + return SBI_ENOTSUPP; +} + static void generic_early_exit(void) { if (generic_plat && generic_plat->early_exit) @@ -236,6 +259,8 @@ const struct sbi_platform_operations platform_ops = { .get_tlbr_flush_limit = generic_tlbr_flush_limit, .timer_init = fdt_timer_init, .timer_exit = fdt_timer_exit, + .vendor_ext_check = generic_vendor_ext_check, + .vendor_ext_provider = generic_vendor_ext_provider, }; struct sbi_platform platform = {