From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35AE3C433F5 for ; Tue, 15 Feb 2022 10:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236807AbiBOKy5 (ORCPT ); Tue, 15 Feb 2022 05:54:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236766AbiBOKyp (ORCPT ); Tue, 15 Feb 2022 05:54:45 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB9DBD884F; Tue, 15 Feb 2022 02:54:35 -0800 (PST) Date: Tue, 15 Feb 2022 10:54:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1644922474; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23RokacYUudoZ7+eyw3MPcHrjY0pBUhtldoR3kVPp0k=; b=F8GgRnd9ZlCBlHF6XGATwxgfDDByumG60oZO4ZieWClsK4MNCvMfTIT46W39ygAS1/B8Ve +NwStRsuYfMUJKGNCCURW3OS5HaH6clZThpTw8NGKDY0PH9FjpyzQnIur1L6RL0gY6ZjpL zbIUfKuuC0SFiRegSs+17QOoIP3ytXfi/fyV4xVhneQSUNcCgzW1QQtNVIirNxRpZCOBuH m50VnWQxVmKWufFbyDpEOC9FOUUrI2ymL+SYoYqKWforXUKuNh2swpPOmrdtSXXndA25bw oqkZiLaCXolKTJ3FhmH9smcCegAC23XzeN39KHRESht9lBS5jOT6yfWgMP6Mmw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1644922474; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23RokacYUudoZ7+eyw3MPcHrjY0pBUhtldoR3kVPp0k=; b=Y1arK0au/aku/2KHml4h94zTYSLc+VhD3BVjAgM703CORcrougvWzmi4d9YkgeXXqmBmlC 92F0kQ/t5fJeVKAQ== From: "tip-bot2 for Fenghua Yu" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/pasid] iommu/ioasid: Introduce a helper to check for valid PASIDs Cc: Ashok Raj , Jacob Pan , Fenghua Yu , Borislav Petkov , Tony Luck , Thomas Gleixner , Lu Baolu , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220207230254.3342514-4-fenghua.yu@intel.com> References: <20220207230254.3342514-4-fenghua.yu@intel.com> MIME-Version: 1.0 Message-ID: <164492247228.16921.14756406633991839692.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/pasid branch of tip: Commit-ID: 7a5fbc9bcba5325a45297a4ba00091f39a63a1ed Gitweb: https://git.kernel.org/tip/7a5fbc9bcba5325a45297a4ba00091f39a63a1ed Author: Fenghua Yu AuthorDate: Mon, 07 Feb 2022 15:02:46 -08:00 Committer: Borislav Petkov CommitterDate: Mon, 14 Feb 2022 19:41:39 +01:00 iommu/ioasid: Introduce a helper to check for valid PASIDs Define a pasid_valid() helper to check if a given PASID is valid. [ bp: Massage commit message. ] Suggested-by: Ashok Raj Suggested-by: Jacob Pan Signed-off-by: Fenghua Yu Signed-off-by: Borislav Petkov Reviewed-by: Tony Luck Reviewed-by: Thomas Gleixner Reviewed-by: Lu Baolu Link: https://lore.kernel.org/r/20220207230254.3342514-4-fenghua.yu@intel.com --- include/linux/ioasid.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/ioasid.h b/include/linux/ioasid.h index e9dacd4..2237f64 100644 --- a/include/linux/ioasid.h +++ b/include/linux/ioasid.h @@ -41,6 +41,10 @@ void *ioasid_find(struct ioasid_set *set, ioasid_t ioasid, int ioasid_register_allocator(struct ioasid_allocator_ops *allocator); void ioasid_unregister_allocator(struct ioasid_allocator_ops *allocator); int ioasid_set_data(ioasid_t ioasid, void *data); +static inline bool pasid_valid(ioasid_t ioasid) +{ + return ioasid != INVALID_IOASID; +} #else /* !CONFIG_IOASID */ static inline ioasid_t ioasid_alloc(struct ioasid_set *set, ioasid_t min, @@ -78,5 +82,10 @@ static inline int ioasid_set_data(ioasid_t ioasid, void *data) return -ENOTSUPP; } +static inline bool pasid_valid(ioasid_t ioasid) +{ + return false; +} + #endif /* CONFIG_IOASID */ #endif /* __LINUX_IOASID_H */