Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp514917imm; Fri, 17 Aug 2018 01:49:10 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxn+EMV3zj2XExgd+xts7bUifYgPP6dMBH5cmn7ECZU5GGcYEvw7TL6tonE4WlGIS1UQDA3 X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr5128622pgo.352.1534495750531; Fri, 17 Aug 2018 01:49:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534495750; cv=none; d=google.com; s=arc-20160816; b=Rk1c+Nnv7UTsq7At/PQD5FtBCg+xb/YSesObGe4wXEk+Ji1EY2LoDWebZxuqIAbXfy NWfxiHJGHRP+NBBFZAxK8OVXezOROIM/d1IqCtu9iRm/Mlxn4Y1HzDtZ12eNdrmz7C1V 0Matu/F3OtWXs4Kjies8OgoX8LVwjnw1RESxCC8+tOd4tCpgqCmg50YCp/erLXGhmpDH TvKPw42SpT39KgFUaEBMVHNtX5yr6Z1Zd38G8oIH6mUonYd3OAeFYYXsUkx40cBZRJA1 dRrCP2+YHQInf+tzQwA48xYJSHbsg/Vm367DvpWkcnpjdZ2ikpCe3UOj3aFx2dCLAyaZ oQ3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:arc-authentication-results; bh=8NdDFsX59QAZh7V/473p6Y++g4Zv9dNhNyjnNEKMNUE=; b=QaVFLo1XRhM6KqD8OloMRRe6zTxt9M1QVLElg1K4T24Y80hAK9sCNNgefgARtTVFC9 Qfi6VQuTdNza8DJndYxnWrtnSK6EUhB4vSoR5Dchnps8MvnQdjgenvERSFkNPSjlnxlD /7YU+HM80xwZi4h9fr9Z00G1afi/N6XleUT2Y+l42Ji0DkkB1DpOfru0xcgWARCt2n2k wtIBt2brYclcyle8ki1On1sY8kXqb49VNcIGbX/46qsxJlZbW0WKlu3/1AMolgIczsyC Qzc6zc37OAI8Z7sP1T9Zn9/t0ad+t2299LC6mWv0a870M/uXM09e8GO1XJA/hqYhvjnn siFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si1628675pgp.439.2018.08.17.01.48.55; Fri, 17 Aug 2018 01:49:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726450AbeHQLuY (ORCPT + 99 others); Fri, 17 Aug 2018 07:50:24 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:40996 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725845AbeHQLuY (ORCPT ); Fri, 17 Aug 2018 07:50:24 -0400 Received: by mail-qt0-f194.google.com with SMTP id e19-v6so7957885qtp.8 for ; Fri, 17 Aug 2018 01:47:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8NdDFsX59QAZh7V/473p6Y++g4Zv9dNhNyjnNEKMNUE=; b=T3eORUIuZgKElNCPaMdbseP8e3C61giaSC3/5k6+F1qP5nNClMoI7HtB9YUvkV3Yxi s7qZ4BJwpJ8LNo/fGLufnLqkBUo8NbBnBr/aoN7H9Or+jbuGWTUZpDwOevvXJ3VRu++d 5RIDrXCm2u8j/8SQilZyd0Dd4fBmagHiRl1kB0W6NRPmT4NSQcr8sWIcoDwFQGWndRVc xpgGjgoge3DkHukEbEZlhgd2cfK6iGohZAuMjBpm+c0uDR51gtHOy7EJMqIqVjTGLIc3 zx2pclp6i9sHf6huvaadkM9luqdCR7PbmE8zuSKc6k9a959KvdDuIJcgtQIMRvo0Kk8n rpEQ== X-Gm-Message-State: AOUpUlE8q5pZTZrjj2Ftr14RzkifVqUzDR/JysTzOPcGoX8LZA8piG44 eBLCGJrK/0qiaB29wT5i2P9RlToOObpLux+07YI= X-Received: by 2002:ac8:2dc6:: with SMTP id q6-v6mr34080772qta.178.1534495670759; Fri, 17 Aug 2018 01:47:50 -0700 (PDT) MIME-Version: 1.0 References: <20180816204506.GA21144@agluck-desk> <20180816232639.GA25889@agluck-desk> In-Reply-To: <20180816232639.GA25889@agluck-desk> From: Arnd Bergmann Date: Fri, 17 Aug 2018 10:47:34 +0200 Message-ID: Subject: Re: how to fix acpi_pci_root_remap_iospace? To: Tony Luck Cc: Bjorn Helgaas , Linux Kernel Mailing List , jchandra@broadcom.com, Sinan Kaya , Tomasz Nowicki , Lorenzo Pieralisi , Boris Brezillon , Miquel Raynal Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 17, 2018 at 1:27 AM Luck, Tony wrote: > > On Thu, Aug 16, 2018 at 11:10:33PM +0200, Arnd Bergmann wrote: > > Another way would be to add > > > > #include > > +#undef PCI_IOBASE > > > > in your asm/io.h. This is about as ugly as the your version, but > > it would be local to ia64 ;-) > > Third way ... > > > Is "0" actually the right value for PCI_IOBASE for some platform? > > #ifndef PCI_IOBASE > #define PCI_IOBASE ((void __iomem *)0) > #endif > > Or is this just here to make sure that: > > static inline u8 inb(unsigned long addr) > { > u8 val; > > __io_pbr(); > val = __raw_readb(PCI_IOBASE + addr); > __io_par(); > return val; > } > > etc. Do not throw errors? Defining it to zero is the traditional approach on some systems, and it's used for at least two different reasons, both of which I don't particularly like: - Some (particularly older) targets that have its I/O space mapped into its linear virtual memory define inb() to be effectively an alias for readb() with the same numeric arguments. This kind of works in most cases but breaks in many corner cases such as * user space using /dev/ioport, which now grants access to all of kernel memory * ISA device drivers using fixed 16-bit addresses on inb/outb, which now points into user space memory * drivers that get the correct address from a resource but then truncate it by storing it in a 16-bit or 32-bit (on 64-bit machines) local variable. - Some targets don't have any support for I/O space on their PCI bus and just want to get things to compile by setting PCI_IOBASE to zero, this still opens up some of the same problems as above, but doesn't really help otherwise. > Should we really just enclose all of inb, inw, inl, ... > inside of: > > #ifdef PCI_IOBASE > > ... all those static functions that use PCI_IOBASE ... This breaks compilation of a couple of important drivers such as serial-8250 which support either I/O or memory space, so it requires some cleanup first, or the definition of an alternative nop inb/outb family that does not try to access the bus. Arnd