From patchwork Tue Aug 8 22:34:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819048 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=gYYYZz7s; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7KM52gSz1yfD for ; Wed, 9 Aug 2023 08:34:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbjHHWe2 (ORCPT ); Tue, 8 Aug 2023 18:34:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230230AbjHHWe2 (ORCPT ); Tue, 8 Aug 2023 18:34:28 -0400 Received: from out-89.mta1.migadu.com (out-89.mta1.migadu.com [95.215.58.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 787BB103 for ; Tue, 8 Aug 2023 15:34:27 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534065; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kMZFiXLbvuUKqAxgf3kGEHVuig7HKmYmUGlXimZwqh0=; b=gYYYZz7sgbjkXiOvct7Hq2K9qMFVYi6dEUWlDONqX31wbF397lhaoHM3Gu25Ys7eZvako7 sYZPMfyIWVfvIbJjpAJLLiU9lLXTr2G54lAaEnB4MeUCQBwZcDHl5k+G/QwNGqjjikkze3 sR6CG5IdMwL+A7es2aH1iHntSoZprGQ= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng , Andi Shyti Subject: [PATCH v2 01/11] PCI/VGA: Use unsigned type for the io_state variable Date: Wed, 9 Aug 2023 06:34:02 +0800 Message-Id: <20230808223412.1743176-2-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng The io_state variable in the vga_arb_write() function is declared with unsigned int type, while the vga_str_to_iostate() function takes 'int *' type. To keep them consistent, this patch replaceis the third argument of vga_str_to_iostate() function with 'unsigned int *' type. Reviewed-by: Andi Shyti Signed-off-by: Sui Jingfeng Reviewed-by: Ilpo Järvinen --- drivers/pci/vgaarb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 5a696078b382..c1bc6c983932 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -77,7 +77,7 @@ static const char *vga_iostate_to_str(unsigned int iostate) return "none"; } -static int vga_str_to_iostate(char *buf, int str_size, int *io_state) +static int vga_str_to_iostate(char *buf, int str_size, unsigned int *io_state) { /* we could in theory hand out locks on IO and mem * separately to userspace but it can cause deadlocks */ From patchwork Tue Aug 8 22:34:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819049 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=PHfyGfjJ; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7KN4Qvkz1yYl for ; Wed, 9 Aug 2023 08:34:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbjHHWeb (ORCPT ); Tue, 8 Aug 2023 18:34:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230319AbjHHWeb (ORCPT ); Tue, 8 Aug 2023 18:34:31 -0400 Received: from out-85.mta1.migadu.com (out-85.mta1.migadu.com [95.215.58.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51FF310B for ; Tue, 8 Aug 2023 15:34:30 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UkFV97CQa3g6DrhggAXuzog1hzg5W10mASK1ByxDhpo=; b=PHfyGfjJY9Ur7O6u9zSuqLtFOfBXyBXUUFDLn09wdIeOTXwBdqdeMkEVbAfYkp+pfrdwJh D5tcQm5d30zgqXzASPmeEsy3pgGMANJ4IzoPHXwSO2Y+GD73xe/yMnpf71ZJqNKtBbj1lo lXO2AMWaiQes21PRybH44bgkLzjtuk4= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 02/11] PCI: Add the pci_get_class_masked() helper Date: Wed, 9 Aug 2023 06:34:03 +0800 Message-Id: <20230808223412.1743176-3-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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-pci@vger.kernel.org From: Sui Jingfeng Because there is no good way to get the mask member used to searching for devices that conform to a specific PCI class code, an application needs to process all PCI display devices can achieve its goal as follows: pdev = NULL; do { pdev = pci_get_class_masked(PCI_BASE_CLASS_DISPLAY << 16, 0xFF0000, pdev); if (pdev) do_something_for_pci_display_device(pdev); } while (pdev); While previously, we just can not ignore Sub-Class code and the Programming Interface byte when do the searching. Signed-off-by: Sui Jingfeng --- drivers/pci/search.c | 30 ++++++++++++++++++++++++++++++ include/linux/pci.h | 7 +++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/pci/search.c b/drivers/pci/search.c index b4c138a6ec02..f1c15aea868b 100644 --- a/drivers/pci/search.c +++ b/drivers/pci/search.c @@ -334,6 +334,36 @@ struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, } EXPORT_SYMBOL(pci_get_device); +/** + * pci_get_class_masked - begin or continue searching for a PCI device by class and mask + * @class: search for a PCI device with this class designation + * @from: Previous PCI device found in search, or %NULL for new search. + * + * Iterates through the list of known PCI devices. If a PCI device is + * found with a matching @class, the reference count to the device is + * incremented and a pointer to its device structure is returned. + * Otherwise, %NULL is returned. + * A new search is initiated by passing %NULL as the @from argument. + * Otherwise if @from is not %NULL, searches continue from next device + * on the global list. The reference count for @from is always decremented + * if it is not %NULL. + */ +struct pci_dev *pci_get_class_masked(unsigned int class, unsigned int mask, + struct pci_dev *from) +{ + struct pci_device_id id = { + .vendor = PCI_ANY_ID, + .device = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, + .class_mask = mask, + .class = class, + }; + + return pci_get_dev_by_id(&id, from); +} +EXPORT_SYMBOL(pci_get_class_masked); + /** * pci_get_class - begin or continue searching for a PCI device by class * @class: search for a PCI device with this class designation diff --git a/include/linux/pci.h b/include/linux/pci.h index 0ff7500772e6..b20e7ba844bf 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1180,6 +1180,9 @@ struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn); struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, unsigned int devfn); struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from); +struct pci_dev *pci_get_class_masked(unsigned int class, unsigned int mask, + struct pci_dev *from); + int pci_dev_present(const struct pci_device_id *ids); int pci_bus_read_config_byte(struct pci_bus *bus, unsigned int devfn, @@ -1895,6 +1898,10 @@ static inline struct pci_dev *pci_get_class(unsigned int class, struct pci_dev *from) { return NULL; } +static inline struct pci_dev *pci_get_class_masked(unsigned int class, + unsigned int mask, + struct pci_dev *from) +{ return NULL; } static inline int pci_dev_present(const struct pci_device_id *ids) { return 0; } From patchwork Tue Aug 8 22:34:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819051 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=bmnuHOjN; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7KV19Mnz1yfD for ; Wed, 9 Aug 2023 08:34:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230424AbjHHWeh (ORCPT ); Tue, 8 Aug 2023 18:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230403AbjHHWeg (ORCPT ); Tue, 8 Aug 2023 18:34:36 -0400 Received: from out-72.mta1.migadu.com (out-72.mta1.migadu.com [95.215.58.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2ADB10B for ; Tue, 8 Aug 2023 15:34:32 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534069; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=noQeSrC40sd/EXkeg8fxahy+pA50ftyssyowKNSXpwM=; b=bmnuHOjNxAVhqjQOMstFLbhvA7AheHtRPdPVazLBqkBj17xtd3uGnHL/K2InWr0ptnzDFD ObY6ZX76LkF1kTuK4SxezbX0dBOd2wGgTr9nMpWDU3JDp173MGKw9ID+4bBl63G0cBZc7O hT1KYhpjhwPNNTyUYGFhYaX3lUZEIYA= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng , Mario Limonciello Subject: [PATCH v2 03/11] PCI/VGA: Deal with VGA class devices Date: Wed, 9 Aug 2023 06:34:04 +0800 Message-Id: <20230808223412.1743176-4-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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-pci@vger.kernel.org From: Sui Jingfeng vgaarb only cares about PCI(e) VGA devices (pdev->class == 0x0300XX) Currently, hence we only need to add VGA devices has its class code equals to 0x0300 to the arbiter. To keep align with the previous behavior. we ignore the programming interface byte (the least significant 8 bits) intentionally. After apply this patch, We will filter the unqualified devices out in the vga_arb_device_init() function. While the current implementation is to search all PCI devices in a system, this is not efficient. This also means that deleting a PCI device no longer needs to walk the list. Note that the major contribution of this patch is optimization. Reviewed-by: Mario Limonciello Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 68 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index c1bc6c983932..8742a51d450f 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -754,10 +754,6 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) struct pci_dev *bridge; u16 cmd; - /* Only deal with VGA class devices */ - if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA) - return false; - /* Allocate structure */ vgadev = kzalloc(sizeof(struct vga_device), GFP_KERNEL); if (vgadev == NULL) { @@ -1493,6 +1489,42 @@ static void vga_arbiter_notify_clients(void) spin_unlock_irqrestore(&vga_lock, flags); } +/* + * The PCI Class Code spec implies that only VGA devices with programming + * interface 0x00 can depend on the legacy VGA address range. VGA devices + * with programming interface 0x01 are 8514-compatible controllers. Since + * VGA devices with programming interface 0x00 is VGA compatible, the 'vga' + * suffix here should refer to the VGA-compatible devices after a strict + * reading of that specification. But considering the fact that there + * probably don't has a 8514-compatible controller that could be used with + * upstream kernel anymore, we would like to just ignore the programming + * interface byte. + * + * Besides, there do exist non VGA-compatible display controllers in the + * world and hardware vendors may abandon the old VGA standard someday. + * The meaning of 'vga' suffix here may change to evolve with time. + * + * A strict understanding of 'vga' certainly should be VGA-compatible, While + * a relaxed understanding of 'vga' would be PCI devices that are able to + * display. Currently, we just keep aligned to the previous behavior. + * Deal with VGA class devices. + */ +static bool pci_dev_is_vga(struct pci_dev *pdev) +{ + if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) + return true; + + /* + * The PCI_CLASS_NOT_DEFINED_VGA is defined to provide backward + * compatibility for devices that were built before the class code + * field was defined. + */ + if ((pdev->class >> 8) == PCI_CLASS_NOT_DEFINED_VGA) + return true; + + return false; +} + static int pci_notify(struct notifier_block *nb, unsigned long action, void *data) { @@ -1502,6 +1534,9 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, vgaarb_dbg(dev, "%s\n", __func__); + if (!pci_dev_is_vga(pdev)) + return 0; + /* For now we're only intereted in devices added and removed. I didn't * test this thing here, so someone needs to double check for the * cases of hotplugable vga cards. */ @@ -1534,8 +1569,8 @@ static struct miscdevice vga_arb_device = { static int __init vga_arb_device_init(void) { + struct pci_dev *pdev = NULL; int rc; - struct pci_dev *pdev; rc = misc_register(&vga_arb_device); if (rc < 0) @@ -1543,13 +1578,22 @@ static int __init vga_arb_device_init(void) bus_register_notifier(&pci_bus_type, &pci_notifier); - /* We add all PCI devices satisfying VGA class in the arbiter by - * default */ - pdev = NULL; - while ((pdev = - pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, - PCI_ANY_ID, pdev)) != NULL) - vga_arbiter_add_pci_device(pdev); + /* + * We add all PCI devices satisfying VGA class in the arbiter + * by default, but we ignore the programming interface byte + * intentionally. + */ + do { + pdev = pci_get_class_masked(PCI_CLASS_DISPLAY_VGA << 8, 0xFFFF00, pdev); + if (pdev && pci_dev_is_vga(pdev)) + vga_arbiter_add_pci_device(pdev); + } while (pdev); + + do { + pdev = pci_get_class_masked(PCI_CLASS_NOT_DEFINED_VGA << 8, 0xFFFF00, pdev); + if (pdev && pci_dev_is_vga(pdev)) + vga_arbiter_add_pci_device(pdev); + } while (pdev); pr_info("loaded\n"); return rc; From patchwork Tue Aug 8 22:34:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Adl1tcB7; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7KT5xcfz1yYl for ; Wed, 9 Aug 2023 08:34:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230506AbjHHWeh (ORCPT ); Tue, 8 Aug 2023 18:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbjHHWee (ORCPT ); Tue, 8 Aug 2023 18:34:34 -0400 Received: from out-80.mta1.migadu.com (out-80.mta1.migadu.com [95.215.58.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D252EFD for ; Tue, 8 Aug 2023 15:34:32 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mu/MhoXFJ/cEi4FsJokzAE/sQ7XHHhWDIZhXGhQKIk8=; b=Adl1tcB78U1uq/fZLe6GYcn43LbRpfgPBKK17xeIW5yXvQaRZ0n/Abirru9G+fZ9WkrwIg C9ZiabiIncjvC0hXZT2kaf7Z7KaAf0tycBNkaCe8u87wtDhLXUmSxsGGtI9dyQZg1sKAHZ tIGGl4udI9xcc1Tdsvdo23/Yipt8Ehs= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 04/11] PCI/VGA: Drop the inline in the vga_update_device_decodes() function. Date: Wed, 9 Aug 2023 06:34:05 +0800 Message-Id: <20230808223412.1743176-5-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng The vga_update_device_decodes() function is not performance-critical. So drop the inline. This patch also makes the parameter consistent with the argument, using the 'unsigned int' type instead of the 'signed' type to store the decode. Change the second argument of the vga_update_device_decodes() function to 'unsigned int' type. Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 8742a51d450f..dc10a262fb5e 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -860,24 +860,24 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev) return ret; } -/* this is called with the lock */ -static inline void vga_update_device_decodes(struct vga_device *vgadev, - int new_decodes) +/* This is called with the lock */ +static void vga_update_device_decodes(struct vga_device *vgadev, + unsigned int new_decodes) { struct device *dev = &vgadev->pdev->dev; - int old_decodes, decodes_removed, decodes_unlocked; + unsigned int old_decodes = vgadev->decodes; + unsigned int decodes_removed = ~new_decodes & old_decodes; + unsigned int decodes_unlocked = vgadev->locks & decodes_removed; - old_decodes = vgadev->decodes; - decodes_removed = ~new_decodes & old_decodes; - decodes_unlocked = vgadev->locks & decodes_removed; vgadev->decodes = new_decodes; - vgaarb_info(dev, "changed VGA decodes: olddecodes=%s,decodes=%s:owns=%s\n", - vga_iostate_to_str(old_decodes), - vga_iostate_to_str(vgadev->decodes), - vga_iostate_to_str(vgadev->owns)); + vgaarb_info(dev, + "VGA decodes changed: olddecodes=%s,decodes=%s:owns=%s\n", + vga_iostate_to_str(old_decodes), + vga_iostate_to_str(vgadev->decodes), + vga_iostate_to_str(vgadev->owns)); - /* if we removed locked decodes, lock count goes to zero, and release */ + /* If we removed locked decodes, lock count goes to zero, and release */ if (decodes_unlocked) { if (decodes_unlocked & VGA_RSRC_LEGACY_IO) vgadev->io_lock_cnt = 0; From patchwork Tue Aug 8 22:34:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819053 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=V2b/yZWh; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7KW0MtZz1yfD for ; Wed, 9 Aug 2023 08:34:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230497AbjHHWei (ORCPT ); Tue, 8 Aug 2023 18:34:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230521AbjHHWeh (ORCPT ); Tue, 8 Aug 2023 18:34:37 -0400 Received: from out-78.mta1.migadu.com (out-78.mta1.migadu.com [95.215.58.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B9B9101 for ; Tue, 8 Aug 2023 15:34:36 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534073; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HQgYw5lX3SkYq1STywg88ED6q5FjX9omCE5FKYEvLx8=; b=V2b/yZWh7iqOPKRM+woaS0Pcn2y/ZwlopGA/To5CR6hBItv7RHn++t0bdatVP+jBdJY3WF XEy5JoecUt0pwfcntmWSCZuzjtsjWYXbh4aYIVQPplR1enGjSuBkUvCm7NtvjmK/1e2a/q t2IOEGUJZhKpiH+y+nQ3gBn4OCPe5HA= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 05/11] PCI/VGA: Move the new_state assignment out of the loop Date: Wed, 9 Aug 2023 06:34:06 +0800 Message-Id: <20230808223412.1743176-6-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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-pci@vger.kernel.org From: Sui Jingfeng In the vga_arbiter_notify_clients() function, the value of the 'new_state' variable will be 'false' on systems that have more than one VGA device. The value will be 'true' if there is only one VGA device or no VGA device at all. Hence, its value is not relevant to the iteration of the loop. So move the assignment clause out of the loop. For a system with multiple video cards, this patch saves unnecessary assignment. Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index dc10a262fb5e..6883067a802a 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -1468,22 +1468,20 @@ static void vga_arbiter_notify_clients(void) { struct vga_device *vgadev; unsigned long flags; - uint32_t new_decodes; - bool new_state; + bool state; if (!vga_arbiter_used) return; + state = (vga_count > 1) ? false : true; + spin_lock_irqsave(&vga_lock, flags); list_for_each_entry(vgadev, &vga_list, list) { - if (vga_count > 1) - new_state = false; - else - new_state = true; if (vgadev->set_decode) { - new_decodes = vgadev->set_decode(vgadev->pdev, - new_state); - vga_update_device_decodes(vgadev, new_decodes); + unsigned int decodes; + + decodes = vgadev->set_decode(vgadev->pdev, state); + vga_update_device_decodes(vgadev, decodes); } } spin_unlock_irqrestore(&vga_lock, flags); From patchwork Tue Aug 8 22:34:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819052 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=Wl506kTC; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7KV47Ssz1yYl for ; Wed, 9 Aug 2023 08:34:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230445AbjHHWeh (ORCPT ); Tue, 8 Aug 2023 18:34:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230519AbjHHWeh (ORCPT ); Tue, 8 Aug 2023 18:34:37 -0400 Received: from out-67.mta1.migadu.com (out-67.mta1.migadu.com [95.215.58.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772DE129 for ; Tue, 8 Aug 2023 15:34:36 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uMmEu+HhjoXxANySD4aMeLT6mwndhCG4N8c23OUDKuI=; b=Wl506kTCXQtMlc2mHYLR0PVSvjYlKXpfKDEhL9z8b9NHnYkkOx5eYk3PeqhY98kd6c4yym sZy1+F9KWA1jTNyhfoZM+i1exotrTiU77Sr7hEtCWtHXWH1Eeuw6HRvzFWdot/X3cr72ow BgHtoJVaqPXVmlq/UafBM8KuDNeeFjg= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 06/11] PCI/VGA: Fix two typos in the comments of pci_notify() Date: Wed, 9 Aug 2023 06:34:07 +0800 Message-Id: <20230808223412.1743176-7-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng 1) s/intereted/interested 2) s/hotplugable/hot-pluggable While at it, convert the comments to the conventional multi-line style, and rewrap to fill 78 columns. Fixes: deb2d2ecd43d ("PCI/GPU: implement VGA arbitration on Linux") Signed-off-by: Sui Jingfeng Reviewed-by: Ilpo Järvinen --- drivers/pci/vgaarb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 6883067a802a..811510253553 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -1535,9 +1535,11 @@ static int pci_notify(struct notifier_block *nb, unsigned long action, if (!pci_dev_is_vga(pdev)) return 0; - /* For now we're only intereted in devices added and removed. I didn't - * test this thing here, so someone needs to double check for the - * cases of hotplugable vga cards. */ + /* + * For now, we're only interested in devices added and removed. + * I didn't test this thing here, so someone needs to double check + * for the cases of hot-pluggable VGA cards. + */ if (action == BUS_NOTIFY_ADD_DEVICE) notify = vga_arbiter_add_pci_device(pdev); else if (action == BUS_NOTIFY_DEL_DEVICE) From patchwork Tue Aug 8 22:34:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819054 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DGYotxqN; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7Kd4WzSz1yYl for ; Wed, 9 Aug 2023 08:34:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231177AbjHHWeo (ORCPT ); Tue, 8 Aug 2023 18:34:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbjHHWel (ORCPT ); Tue, 8 Aug 2023 18:34:41 -0400 Received: from out-76.mta1.migadu.com (out-76.mta1.migadu.com [95.215.58.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3E201B4 for ; Tue, 8 Aug 2023 15:34:39 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534076; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OzZwtUzLVgyigIZtu0FTQnFL+tgS0hu77QEo/xERbug=; b=DGYotxqNLyZsNF2IhhW+hGPcxHM/d9eMPF9lhqKC3341P3IrJ+qrPvpcLToq9oBZD1PR0F A2j9JANAQEm7SnZ98HhQ6RDX0BuJJNhpHUfinaFEM9j29EBLRlA84huObzAoFTeTMViyZD 1oWz4mA51DDBJiuVfb30E9SV7R7bhqY= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 07/11] PCI/VGA: vga_client_register() return -ENODEV on failure, not -1 Date: Wed, 9 Aug 2023 06:34:08 +0800 Message-Id: <20230808223412.1743176-8-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng Fixes: 934f992c763a ("drm/i915: Recognise non-VGA display devices") Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 811510253553..a6b8c0def35d 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -964,7 +964,7 @@ EXPORT_SYMBOL(vga_set_legacy_decoding); * * To unregister just call vga_client_unregister(). * - * Returns: 0 on success, -1 on failure + * Returns: 0 on success, -ENODEV on failure */ int vga_client_register(struct pci_dev *pdev, unsigned int (*set_decode)(struct pci_dev *pdev, bool decode)) @@ -975,16 +975,13 @@ int vga_client_register(struct pci_dev *pdev, spin_lock_irqsave(&vga_lock, flags); vgadev = vgadev_find(pdev); - if (!vgadev) - goto bail; - - vgadev->set_decode = set_decode; - ret = 0; - -bail: + if (vgadev) { + vgadev->set_decode = set_decode; + ret = 0; + } spin_unlock_irqrestore(&vga_lock, flags); - return ret; + return ret; } EXPORT_SYMBOL(vga_client_register); From patchwork Tue Aug 8 22:34:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819055 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=JdE3KgMC; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7Kf0FT7z1yfD for ; Wed, 9 Aug 2023 08:34:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbjHHWep (ORCPT ); Tue, 8 Aug 2023 18:34:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231269AbjHHWem (ORCPT ); Tue, 8 Aug 2023 18:34:42 -0400 Received: from out-96.mta1.migadu.com (out-96.mta1.migadu.com [95.215.58.96]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84C861B6 for ; Tue, 8 Aug 2023 15:34:40 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HL5I7G8dsIM9Q8e95v2AAu8NCj6dOoJOu6bCCYAPQBw=; b=JdE3KgMCOK9a99gLEqtXjTkM6oTKGWFQ7ZBtDjo5B938KLh4I3KEf+gb7oxO+HGWfwbr13 FebIHA9+iE68toGO3+RBtqvbI+a45IPZtIgNMzmG2zeGvdsHGbysQGgPp3IMs1G5wy1d99 ydCkC3Yv99i7zinBd4y1UjMJQ/PM8tw= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 08/11] PCI/VGA: Fix a typo to the comment of vga_default Date: Wed, 9 Aug 2023 06:34:09 +0800 Message-Id: <20230808223412.1743176-9-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng Fixes: deb2d2ecd43d ("PCI/GPU: implement VGA arbitration on Linux") Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index a6b8c0def35d..d80d92e8012b 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -99,7 +99,7 @@ static int vga_str_to_iostate(char *buf, int str_size, unsigned int *io_state) return 1; } -/* this is only used a cookie - it should not be dereferenced */ +/* This is only used as a cookie, it should not be dereferenced */ static struct pci_dev *vga_default; /* Find somebody in our list */ From patchwork Tue Aug 8 22:34:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=lozfXp23; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7Kr6tpDz1yYl for ; Wed, 9 Aug 2023 08:34:56 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231303AbjHHWe4 (ORCPT ); Tue, 8 Aug 2023 18:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230525AbjHHWew (ORCPT ); Tue, 8 Aug 2023 18:34:52 -0400 Received: from out-73.mta1.migadu.com (out-73.mta1.migadu.com [95.215.58.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3B4F1BDA for ; Tue, 8 Aug 2023 15:34:43 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OARNfgYqqI88j77QXNxHtR+yC6FyBlqX15NF2v91/5s=; b=lozfXp23rVPsktvtX0gQPBInuNuig15+ZDtuPcOb13UrzI+pPqoY2CJAbTcGLRNR3hpifa Lk4NFkJOW+/QvdT7VW8ZrfhLaMqDztMIWavX2Oj+hUmGh41afMdVPFemFneKZ857g5VIxG EVKpXS7FQqH0cq3Yd+NENo3KiAtV904= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng Subject: [PATCH v2 09/11] PCI/VGA: Fix a typo to the comments in vga_str_to_iostate() function Date: Wed, 9 Aug 2023 06:34:10 +0800 Message-Id: <20230808223412.1743176-10-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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-pci@vger.kernel.org From: Sui Jingfeng s/chekcing/checking While at it, convert the comments to the conventional multi-line style, and rewrap to fill 78 columns. Fixes: deb2d2ecd43d ("PCI/GPU: implement VGA arbitration on Linux") Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index d80d92e8012b..9f5cf6a6e3a2 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -79,14 +79,16 @@ static const char *vga_iostate_to_str(unsigned int iostate) static int vga_str_to_iostate(char *buf, int str_size, unsigned int *io_state) { - /* we could in theory hand out locks on IO and mem - * separately to userspace but it can cause deadlocks */ + /* + * In theory, we could hand out locks on IO and MEM separately to + * userspace, but this can cause deadlocks. + */ if (strncmp(buf, "none", 4) == 0) { *io_state = VGA_RSRC_NONE; return 1; } - /* XXX We're not chekcing the str_size! */ + /* XXX We're not checking the str_size! */ if (strncmp(buf, "io+mem", 6) == 0) goto both; else if (strncmp(buf, "io", 2) == 0) From patchwork Tue Aug 8 22:34:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=YymOgW8C; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7Ks4SFDz1yYl for ; Wed, 9 Aug 2023 08:34:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230525AbjHHWe4 (ORCPT ); Tue, 8 Aug 2023 18:34:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231393AbjHHWex (ORCPT ); Tue, 8 Aug 2023 18:34:53 -0400 Received: from out-106.mta1.migadu.com (out-106.mta1.migadu.com [95.215.58.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15503FE for ; Tue, 8 Aug 2023 15:34:44 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H4g+gRjFecZE2l454iUAcMz9yAShEeOm1Ufke43adhQ=; b=YymOgW8CFZULQYY6dN/q81w8GNnnaoKcCtuwAOpZoPcfZRCwupzLz8LVeGNPr64w3kasiZ y8xw8VbZCIEvk3ZloPLmkXO8nt5a5azIgveuyIphmOID5DM9vU4jYwtHs9EnRxBhmmEVvV I55Y9CN3mCApYRXMkTVkQL8eqUVm1xA= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng , Andi Shyti Subject: [PATCH v2 10/11] PCI/VGA: Tidy up the code and comment format Date: Wed, 9 Aug 2023 06:34:11 +0800 Message-Id: <20230808223412.1743176-11-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng This patch replaces the leading space with a tab and removes the double blank line and fix various typos, no functional change. Reviewed-by: Andi Shyti Signed-off-by: Sui Jingfeng Reviewed-by: Ilpo Järvinen --- drivers/pci/vgaarb.c | 90 ++++++++++++++++++++++++------------------ include/linux/vgaarb.h | 4 +- 2 files changed, 53 insertions(+), 41 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 9f5cf6a6e3a2..a2f6e0e6b634 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -30,14 +30,13 @@ #include #include #include - #include - #include static void vga_arbiter_notify_clients(void); + /* - * We keep a list of all vga devices in the system to speed + * We keep a list of all VGA devices in the system to speed * up the various operations of the arbiter */ struct vga_device { @@ -61,7 +60,6 @@ static bool vga_arbiter_used; static DEFINE_SPINLOCK(vga_lock); static DECLARE_WAIT_QUEUE_HEAD(vga_wait_queue); - static const char *vga_iostate_to_str(unsigned int iostate) { /* Ignore VGA_RSRC_IO and VGA_RSRC_MEM */ @@ -195,14 +193,16 @@ int vga_remove_vgacon(struct pci_dev *pdev) #endif EXPORT_SYMBOL(vga_remove_vgacon); -/* If we don't ever use VGA arb we should avoid - turning off anything anywhere due to old X servers getting - confused about the boot device not being VGA */ +/* + * If we don't ever use vgaarb, we should avoid turning off anything anywhere. + * Due to old X servers getting confused about the boot device not being VGA. + */ static void vga_check_first_use(void) { - /* we should inform all GPUs in the system that - * VGA arb has occurred and to try and disable resources - * if they can */ + /* + * We should inform all GPUs in the system that + * vgaarb has occurred and to try and disable resources if they can + */ if (!vga_arbiter_used) { vga_arbiter_used = true; vga_arbiter_notify_clients(); @@ -218,7 +218,8 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev, unsigned int pci_bits; u32 flags = 0; - /* Account for "normal" resources to lock. If we decode the legacy, + /* + * Account for "normal" resources to lock. If we decode the legacy, * counterpart, we need to request it as well */ if ((rsrc & VGA_RSRC_NORMAL_IO) && @@ -238,7 +239,8 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev, if (wants == 0) goto lock_them; - /* We don't need to request a legacy resource, we just enable + /* + * We don't need to request a legacy resource, we just enable * appropriate decoding and go */ legacy_wants = wants & VGA_RSRC_LEGACY_MASK; @@ -254,7 +256,8 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev, if (vgadev == conflict) continue; - /* We have a possible conflict. before we go further, we must + /* + * We have a possible conflict. before we go further, we must * check if we sit on the same bus as the conflicting device. * if we don't, then we must tie both IO and MEM resources * together since there is only a single bit controlling @@ -265,13 +268,15 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev, lwants = VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM; } - /* Check if the guy has a lock on the resource. If he does, + /* + * Check if the guy has a lock on the resource. If he does, * return the conflicting entry */ if (conflict->locks & lwants) return conflict; - /* Ok, now check if it owns the resource we want. We can + /* + * Ok, now check if it owns the resource we want. We can * lock resources that are not decoded, therefore a device * can own resources it doesn't decode. */ @@ -279,14 +284,16 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev, if (!match) continue; - /* looks like he doesn't have a lock, we can steal + /* + * Looks like he doesn't have a lock, we can steal * them from him */ flags = 0; pci_bits = 0; - /* If we can't control legacy resources via the bridge, we + /* + * If we can't control legacy resources via the bridge, we * also need to disable normal decoding. */ if (!conflict->bridge_has_one_vga) { @@ -313,7 +320,8 @@ static struct vga_device *__vga_tryget(struct vga_device *vgadev, } enable_them: - /* ok dude, we got it, everybody conflicting has been disabled, let's + /* + * Ok dude, we got it, everybody conflicting has been disabled, let's * enable us. Mark any bits in "owns" regardless of whether we * decoded them. We can lock resources we don't decode, therefore * we must track them via "owns". @@ -355,7 +363,8 @@ static void __vga_put(struct vga_device *vgadev, unsigned int rsrc) vgaarb_dbg(dev, "%s\n", __func__); - /* Update our counters, and account for equivalent legacy resources + /* + * Update our counters, and account for equivalent legacy resources * if we decode them */ if ((rsrc & VGA_RSRC_NORMAL_IO) && vgadev->io_norm_cnt > 0) { @@ -373,7 +382,8 @@ static void __vga_put(struct vga_device *vgadev, unsigned int rsrc) if ((rsrc & VGA_RSRC_LEGACY_MEM) && vgadev->mem_lock_cnt > 0) vgadev->mem_lock_cnt--; - /* Just clear lock bits, we do lazy operations so we don't really + /* + * Just clear lock bits, we do lazy operations so we don't really * have to bother about anything else at this point */ if (vgadev->io_lock_cnt == 0) @@ -381,7 +391,8 @@ static void __vga_put(struct vga_device *vgadev, unsigned int rsrc) if (vgadev->mem_lock_cnt == 0) vgadev->locks &= ~VGA_RSRC_LEGACY_MEM; - /* Kick the wait queue in case somebody was waiting if we actually + /* + * Kick the wait queue in case somebody was waiting if we actually * released something */ if (old_locks != vgadev->locks) @@ -449,8 +460,8 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible) if (conflict == NULL) break; - - /* We have a conflict, we wait until somebody kicks the + /* + * We have a conflict, we wait until somebody kicks the * work queue. Currently we have one work queue that we * kick each time some resources are released, but it would * be fairly easy to have a per device one so that we only @@ -667,7 +678,7 @@ static bool vga_is_boot_device(struct vga_device *vgadev) } /* - * vgadev has neither IO nor MEM enabled. If we haven't found any + * Vgadev has neither IO nor MEM enabled. If we haven't found any * other VGA devices, it is the best candidate so far. */ if (!boot_vga) @@ -708,7 +719,7 @@ static void vga_arbiter_check_bridge_sharing(struct vga_device *vgadev) bus = same_bridge_vgadev->pdev->bus; bridge = bus->self; - /* see if the share a bridge with this device */ + /* See if the share a bridge with this device */ if (new_bridge == bridge) { /* * If their direct parent bridge is the same @@ -779,9 +790,10 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev) vgadev->decodes = VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM | VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; - /* by default mark it as decoding */ + /* By default, mark it as decoding */ vga_decode_count++; - /* Mark that we "own" resources based on our enables, we will + /* + * Mark that we "own" resources based on our enables, we will * clear that below if the bridge isn't forwarding */ pci_read_config_word(pdev, PCI_COMMAND, &cmd); @@ -888,7 +900,7 @@ static void vga_update_device_decodes(struct vga_device *vgadev, __vga_put(vgadev, decodes_unlocked); } - /* change decodes counter */ + /* Change decodes counter */ if (old_decodes & VGA_RSRC_LEGACY_MASK && !(new_decodes & VGA_RSRC_LEGACY_MASK)) vga_decode_count--; @@ -912,14 +924,15 @@ static void __vga_set_legacy_decoding(struct pci_dev *pdev, if (vgadev == NULL) goto bail; - /* don't let userspace futz with kernel driver decodes */ + /* Don't let userspace futz with kernel driver decodes */ if (userspace && vgadev->set_decode) goto bail; - /* update the device decodes + counter */ + /* Update the device decodes + counter */ vga_update_device_decodes(vgadev, decodes); - /* XXX if somebody is going from "doesn't decode" to "decodes" state + /* + * XXX if somebody is going from "doesn't decode" to "decodes" state * here, additional care must be taken as we may have pending owner * ship of non-legacy region ... */ @@ -954,9 +967,9 @@ EXPORT_SYMBOL(vga_set_legacy_decoding); * @set_decode callback: If a client can disable its GPU VGA resource, it * will get a callback from this to set the encode/decode state. * - * Rationale: we cannot disable VGA decode resources unconditionally some single - * GPU laptops seem to require ACPI or BIOS access to the VGA registers to - * control things like backlights etc. Hopefully newer multi-GPU laptops do + * Rationale: we cannot disable VGA decode resources unconditionally, some + * single GPU laptops seem to require ACPI or BIOS access to the VGA registers + * to control things like backlights etc. Hopefully newer multi-GPU laptops do * something saner, and desktops won't have any special ACPI for this. The * driver will get a callback when VGA arbitration is first used by userspace * since some older X servers have issues. @@ -1074,7 +1087,6 @@ static int vga_pci_str_to_vars(char *buf, int count, unsigned int *domain, int n; unsigned int slot, func; - n = sscanf(buf, "PCI:%x:%x:%x.%x", domain, bus, &slot, &func); if (n != 4) return 0; @@ -1113,7 +1125,8 @@ static ssize_t vga_arb_read(struct file *file, char __user *buf, /* Find card vgadev structure */ vgadev = vgadev_find(pdev); if (vgadev == NULL) { - /* Wow, it's not in the list, that shouldn't happen, + /* + * Wow, it's not in the list, that shouldn't happen, * let's fix us up and return invalid card */ spin_unlock_irqrestore(&vga_lock, flags); @@ -1309,7 +1322,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user *buf, curr_pos += 7; remaining -= 7; pr_debug("client 0x%p called 'target'\n", priv); - /* if target is default */ + /* If target is default */ if (!strncmp(curr_pos, "default", 7)) pdev = pci_dev_get(vga_default_device()); else { @@ -1426,7 +1439,6 @@ static int vga_arb_open(struct inode *inode, struct file *file) priv->cards[0].io_cnt = 0; priv->cards[0].mem_cnt = 0; - return 0; } @@ -1460,7 +1472,7 @@ static int vga_arb_release(struct inode *inode, struct file *file) } /* - * callback any registered clients to let them know we have a + * Callback any registered clients to let them know we have a * change in VGA cards */ static void vga_arbiter_notify_clients(void) diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index b4b9137f9792..6d5465f8c3f2 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h @@ -96,7 +96,7 @@ static inline int vga_client_register(struct pci_dev *pdev, static inline int vga_get_interruptible(struct pci_dev *pdev, unsigned int rsrc) { - return vga_get(pdev, rsrc, 1); + return vga_get(pdev, rsrc, 1); } /** @@ -111,7 +111,7 @@ static inline int vga_get_interruptible(struct pci_dev *pdev, static inline int vga_get_uninterruptible(struct pci_dev *pdev, unsigned int rsrc) { - return vga_get(pdev, rsrc, 0); + return vga_get(pdev, rsrc, 0); } static inline void vga_client_unregister(struct pci_dev *pdev) From patchwork Tue Aug 8 22:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 1819058 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=VzX0NaB3; dkim-atps=neutral Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by legolas.ozlabs.org (Postfix) with ESMTP id 4RL7LN1ZxKz1yfB for ; Wed, 9 Aug 2023 08:35:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjHHWfW (ORCPT ); Tue, 8 Aug 2023 18:35:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231650AbjHHWfD (ORCPT ); Tue, 8 Aug 2023 18:35:03 -0400 Received: from out-71.mta1.migadu.com (out-71.mta1.migadu.com [95.215.58.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B212135 for ; Tue, 8 Aug 2023 15:34:50 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1691534084; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n2KFV/GN0Dmb6et1uDl+6TYtEpvdFh6+eq04+vTqbWA=; b=VzX0NaB351C6DD8+HdAwI+2BBgaKp2DsPKyaTS6As2g7L5PxYjrvf5vfDSVgcA0J8YI6PJ GA6YFt8Nh5z4a8MaCiHjB2y67MO/1paidHZYY/cbgJNT8C4i9ceGIzVl/Ji2kJbAJAJ+a+ MLiStpKVoDyv4jBAwc2FEAMw/u4IdxM= From: Sui Jingfeng To: Bjorn Helgaas Cc: Dave Airlie , Daniel Vetter , linux-pci@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Sui Jingfeng , Andi Shyti Subject: [PATCH v2 11/11] PCI/VGA: Replace full MIT license text with SPDX identifier Date: Wed, 9 Aug 2023 06:34:12 +0800 Message-Id: <20230808223412.1743176-12-sui.jingfeng@linux.dev> In-Reply-To: <20230808223412.1743176-1-sui.jingfeng@linux.dev> References: <20230808223412.1743176-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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-pci@vger.kernel.org From: Sui Jingfeng Per Documentation/process/license-rules.rst, the SPDX MIT identifier is equivalent to including the entire MIT license text from LICENSES/preferred/MIT. Replace the MIT license text with the equivalent SPDX identifier. Signed-off-by: Sui Jingfeng Reviewed-by: Andi Shyti --- include/linux/vgaarb.h | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h index 6d5465f8c3f2..97129a1bbb7d 100644 --- a/include/linux/vgaarb.h +++ b/include/linux/vgaarb.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: MIT */ + /* * The VGA aribiter manages VGA space routing and VGA resource decode to * allow multiple VGA devices to be used in a system in a safe way. @@ -5,27 +7,6 @@ * (C) Copyright 2005 Benjamin Herrenschmidt * (C) Copyright 2007 Paulo R. Zanoni * (C) Copyright 2007, 2009 Tiago Vignatti - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS - * IN THE SOFTWARE. - * */ #ifndef LINUX_VGA_H