From patchwork Mon Apr 10 11:58:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongji Xie X-Patchwork-Id: 748970 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w1pkM3sm1z9s7F for ; Mon, 10 Apr 2017 22:03:55 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Kk0VGj0G"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w1pkM2pwWzDqFt for ; Mon, 10 Apr 2017 22:03:55 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Kk0VGj0G"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pg0-x241.google.com (mail-pg0-x241.google.com [IPv6:2607:f8b0:400e:c05::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3w1pgb27v3zDqFw for ; Mon, 10 Apr 2017 22:01:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Kk0VGj0G"; dkim-atps=neutral Received: by mail-pg0-x241.google.com with SMTP id 81so25490515pgh.3 for ; Mon, 10 Apr 2017 05:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=o+6qwYNaesChJ91rTEEBmN09d1tkv40cMEKS8tmF2gg=; b=Kk0VGj0Ga/XBGxEMb/pPpOyKOdZz3CaCylGRmC6WBFE0cXuqg0Gw24q5OCW+/Q/MhE Le4iH2OeoHW0jw7opdtAQ64+92SfPU8G8Nf3EtVjwJij9jVvLvSFrbMjicde4VoayjEt dN2qtWMijm+Q8EdOBh2M70i4CAOYJGGVsrtk+rze1PvG1C2Hmj8nhRSYIH2w1zmAOQyP l3fJt50fm9wooviBN6spb/ULWAyd+SuPYbDp1M88P+l9m9Ny5wvRRc2r6fa69/qiJ6wp 1w6fxiCfOcT0H4RQLMV/CCu5iXQMrOjGc/Pg9wG0pyAvagwWjltRFe/SNQ1hfaYhaPZJ 1wUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=o+6qwYNaesChJ91rTEEBmN09d1tkv40cMEKS8tmF2gg=; b=clgBbHLSp00u6yhvdX/S7kuXfvnrq031sdXpe17ad2HutZSh993gD9kFFTzRvpQ5Cg qSLpR4dA7ENqEYpobU86j3RdytDm3ZSJ0YBySThP+CBZLK50HOXa2eJnb51Pqp7miZCy 9AF2ratuXqD2FdfzU3D1CSTRlxMb9E1k+x5N1R+rTtpdHCQ+nzSldY4YuMgu6Ej0mLbG i8BIDQINaaqdQ6BDxCZZXBs1lRnsvm+eZUz+Xhnv0HkhskthlOAL0edT4OnQ+2MsMVxR 3Prbx7f9wTHKtkwH/S2H/KmrCugjLI5EeWln9TE3uK9ujSPj+6A4So2bNP47AIAHAcuT AO3w== X-Gm-Message-State: AFeK/H2gggp/JolbeWGEldC6vUJNSc4DmXilqiWIvkoHMSl0NQPzbM8K0vhIQnma0ou3Eg== X-Received: by 10.84.197.1 with SMTP id m1mr67580185pld.183.1491825689649; Mon, 10 Apr 2017 05:01:29 -0700 (PDT) Received: from localhost ([116.247.112.152]) by smtp.gmail.com with ESMTPSA id d1sm24498470pfa.5.2017.04.10.05.01.28 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 10 Apr 2017 05:01:29 -0700 (PDT) From: Yongji Xie To: bhelgaas@google.com Subject: [PATCH v10 1/4] PCI: A fix for caculating bridge window's size and alignment Date: Mon, 10 Apr 2017 19:58:11 +0800 Message-Id: <1491825494-19331-2-git-send-email-elohimes@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1491825494-19331-1-git-send-email-elohimes@gmail.com> References: <1491825494-19331-1-git-send-email-elohimes@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: zhong@linux.vnet.ibm.com, aik@ozlabs.ru, linux-pci@vger.kernel.org, gwshan@linux.vnet.ibm.com, alex.williamson@redhat.com, paulus@samba.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" In case that one device's alignment is greater than its size, we may get an incorrect size and alignment for its bus's memory window in pbus_size_mem(). This patch fixes this case. Signed-off-by: Yongji Xie --- drivers/pci/setup-bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index cb389277..958da7d 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1066,10 +1066,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, r->flags = 0; continue; } - size += r_size; + size += max(r_size, align); /* Exclude ranges with size > align from calculation of the alignment. */ - if (r_size == align) + if (r_size <= align) aligns[order] += align; if (order > max_order) max_order = order;