Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp656201ybm; Thu, 28 May 2020 11:49:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEKHk4mTts7WQBi7AliM/wIYpoliw4WKz9ZEEKXoMayRUkrinikwtjjhVui+g5CuPAGykM X-Received: by 2002:aa7:d806:: with SMTP id v6mr2926045edq.174.1590691781572; Thu, 28 May 2020 11:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590691781; cv=none; d=google.com; s=arc-20160816; b=NufTMwXlm+DAy4Tgst6kKG8OCqFu7H0fkHLm9X8iDe5FbaXA4dTq/xOvCIXIb5lkwO dfF1TZP+DjPakxg7OU/KZoomGrxYV+tdapxNZn74DqQhKPjGgVMcNaWu6HzSHoD72s3a 7ux9dKLewRyrdPPRQpiqhK1ZAhn+vBi6OUf/i/kN+/jVXTnEw9uTSyByDe3jf3bcDmAQ wW0NvyfNXN+L18KEHxvTjb69AZJoJgoKHoBbDO3FHtf2AwagH6FDIhlw1kZN/F+InXU0 yHKUibloEPhTaEjNepB7MIRPaY4ptdPlEyxIEsXO9BMjhuTw2BdyfYOlM/H99rcQpP4W M01g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to:dkim-signature; bh=C0hYqHcMOeGmeNkFJaRKYE9LRqgonnvy7dyDwDZLMKk=; b=soVEQ3ogcSb9fHdoSc7ffJyADzklW9noZYX03PepILWa0sDtOkzHthnAUrEN8hG7IR Ab9P+NqpnwPvlcBCOT3Bkq12znMkD4KpIUVlcFmkJr7PpdzRP03nSFCnjO9RoW3Fp9lA 0TVpm8P3PMtAJ2k+7+a3zyI5udhkPoaLAZP6cdZIw9sn0mvTKtION6o3Dpenn8CMLmez G3BtkTh4mjU0rIGM25A1FqtXULxRRhRroefiMmx1KFL+hmHgVcCDg/fveLxbeS+TM/FY jGHXX3SDMtaDfJfS+nPRG1EM0MpnDahteUreIWyr5BXOnqCfHXOrO/Gz3b4Z/YgEoGlG C0oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z+7cOlU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w24si4122611edv.588.2020.05.28.11.49.13; Thu, 28 May 2020 11:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z+7cOlU1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405977AbgE1Sr0 (ORCPT + 99 others); Thu, 28 May 2020 14:47:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405966AbgE1SrY (ORCPT ); Thu, 28 May 2020 14:47:24 -0400 Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EFB7C08C5C6; Thu, 28 May 2020 11:47:23 -0700 (PDT) Received: by mail-ed1-x543.google.com with SMTP id bs4so915426edb.6; Thu, 28 May 2020 11:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=C0hYqHcMOeGmeNkFJaRKYE9LRqgonnvy7dyDwDZLMKk=; b=Z+7cOlU1Z+FswU1WSwnvV2gStkFRPyxQ8ZhAIpohlCoCBMIOFhAF9UdQZq2dMxTVi/ u3vdVfV7ZgPht/zGL1mG4HDugozPSsHUyRB+brGbftGi6PoVjvR1+33I517fD/zazGhZ 22yyHsv384ySypfY0RphM2zS72g5YV+i8VJiq/j6FvPDGQBQs48cWtW/CQja5Trr5QBw 0E4gy64WdaNuRPObBHndMGtCyGfoAg2AT0uv9bt72g3uCAhZZIODedBHkQ44q4PeNfkM y1y2DuIsOdYMLcn9L/lAeG/S+mG0o5HWxvwrVeUM63UZ9a2x3P/ON2Su7CwMskmE7ggY Rpag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=C0hYqHcMOeGmeNkFJaRKYE9LRqgonnvy7dyDwDZLMKk=; b=PRvC/ctv7qcDvuXyZD1ogVGArQUKatuS/fTBYruuiZm6jhHAkl5ZdeXY6ZttcHasMF As6ppHFqww/Om9RxbOcs+ENkU3jvLpWhWgYYLJxuV6i0fB4Ww5uDyDaDerZ8DfO9reY9 zKOYObmgnOr8nyuBLBAOX149UJmQbIEXhSCchzHa7qFYHEw2iwuP1idd+e2XLdH6b70K 5wFbwy/SpCswfJQZ7H4JDibocPtXTBwSrj2w5b6pCAG5vVa08prqbcW9izreyIlE3BaL PjppzKjDjNDkIGsnQ4NZF0LTVINIRHOMPAmDQfnO+oYe9Ed25yIH/HUDU780rTx3/9FA tdEA== X-Gm-Message-State: AOAM530ang6rQX16F9ZKqRw76NtsYLs0dl5gEr/guQ350cxXzRetRUWG HR/AWqHSv/LyZQYT84u2cvF3L7rZ X-Received: by 2002:a50:a412:: with SMTP id u18mr4739604edb.192.1590691641603; Thu, 28 May 2020 11:47:21 -0700 (PDT) Received: from ?IPv6:2003:ea:8f28:5200:593c:f5d:44cf:3de4? (p200300ea8f285200593c0f5d44cf3de4.dip0.t-ipconnect.de. [2003:ea:8f28:5200:593c:f5d:44cf:3de4]) by smtp.googlemail.com with ESMTPSA id b14sm5038552edx.93.2020.05.28.11.47.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 11:47:21 -0700 (PDT) To: Bjorn Helgaas Cc: "linux-pci@vger.kernel.org" , Linux Kernel Mailing List From: Heiner Kallweit Subject: PCI: Disable not requested resource types in pci_enable_resources Message-ID: <18bb3264-9901-135d-8b40-1ee98dd672f1@gmail.com> Date: Thu, 28 May 2020 20:47:12 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, if both resource types are enabled before the call, the mask value doesn't matter. Means as of today I wouldn't be able to e.g. disable PCI_COMMAND_IO. At least my interpretation is that mask defines which resource types are enabled after the call. Therefore change the behavior to disable not requested resource types. At least on my x86 devices this change doesn't have side effects. Signed-off-by: Heiner Kallweit --- drivers/pci/setup-res.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index d21fa04fa..6ef458c10 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -459,8 +459,8 @@ int pci_enable_resources(struct pci_dev *dev, int mask) int i; struct resource *r; - pci_read_config_word(dev, PCI_COMMAND, &cmd); - old_cmd = cmd; + pci_read_config_word(dev, PCI_COMMAND, &old_cmd); + cmd = old_cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY); for (i = 0; i < PCI_NUM_RESOURCES; i++) { if (!(mask & (1 << i))) -- 2.26.2