Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp850460ybt; Fri, 10 Jul 2020 14:10:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCfgEk8IRE+qkUBB8P4jrq7j157XDUpI1Dv3m7L+loRb/LLlonxARcQ7vCAKMx2wx5GGb7 X-Received: by 2002:aa7:d989:: with SMTP id u9mr61732496eds.85.1594415425734; Fri, 10 Jul 2020 14:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594415425; cv=none; d=google.com; s=arc-20160816; b=C+engehT2XGiIQmFCZ17NHb1F4kKPDonHIaDXnlqBgcVq+nSXCqFqBlI1R1NtuIWFg VeAh6NLnNSUuq5LDp7hOv+bfraaQm+ULYHJeGYuxsQIM72D9rxDsEoewFxB+sIhxalEi AOz3IGCwydbgV79KbNPo1O8QczBx634XtkrODGrU/5jAm28XEh6ZDo0nYNO5o24x+vgM 3RgNuRLuIXheks8lIYh4Aa4kA9ZgruXYRz7FZDWzfbw8rl4jOhYZ+obL98umiWYM+on6 xc7If/qH2pZBtXatgdvPDqbVp84cWSrYzMGaCCIE/LVSjGWqkD9VJthqS9O+QpGBXemU jDiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=l/KIWZZO7C19CYmrrgjaw6gCwIcRFr62Ro76LRbt1yY=; b=w0mq35t3n8SHa321eiRqKY8KjCTorM80OFGnZfeHs8r6vpHGWfE0B0v9HXbbDvzeeC l/lBYWEybonfkQ1wLgjOkANP508iRYKG/Z03lCGK3Fl3y6Bvbj0es/rNjUyu7nr6d0IK s2Hlyu6AKdhaywkPjIPMvuR+VxzrUjCzVx7J3GU/AgmeeoajKRzS3RedVJHFI1hF33g8 JXRy623QvJp/pVPA6kWeooQUrHTf48Ojqqt1H//FzgI+jrmD+fD1l0aNvSYat2QM8Dcj FCbZDXGoJg4MNrj6VsZijqhC282vT1Fd+y2LZ4XFJgPRK80VKWtoLI/rzHt01T91sDuS zZCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=z0+GTNPn; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t24si4814596eds.158.2020.07.10.14.10.02; Fri, 10 Jul 2020 14:10:25 -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=@kernel.org header.s=default header.b=z0+GTNPn; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726289AbgGJVJ1 (ORCPT + 99 others); Fri, 10 Jul 2020 17:09:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726223AbgGJVJ1 (ORCPT ); Fri, 10 Jul 2020 17:09:27 -0400 Received: from localhost (mobile-166-175-191-139.mycingular.net [166.175.191.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52D5520748; Fri, 10 Jul 2020 21:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594415366; bh=3G98qnEaA/R516BEiJIDzuUxC5EndF3JHX2eXGymybA=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=z0+GTNPn0bhj5UyUdVoFvb7htf9qSPKOOnb3HqyG7uLdhnEOEAVcdTA5nmrLV06Pj 4/X3u/LMZbHP/M28Qj5MvEfjixgagHB6RamRQ6TewsNBpCVVJnvtV1S1mOarCv5qg4 aQOwuzESUBqh550N2mDLnLbjHtnjT5zdY0BbOCb8= Date: Fri, 10 Jul 2020 16:09:24 -0500 From: Bjorn Helgaas To: Heiner Kallweit Cc: Bjorn Helgaas , "linux-pci@vger.kernel.org" , Linux Kernel Mailing List Subject: Re: PCI: Disable not requested resource types in pci_enable_resources Message-ID: <20200710210924.GA80868@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18bb3264-9901-135d-8b40-1ee98dd672f1@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2020 at 08:47:12PM +0200, Heiner Kallweit wrote: > 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. Does this have a practical benefit? If it fixes a bug or if there's something useful we can do because of this patch, I'll push it higher up the priority list. > 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 >