All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"hch@infradead.org" <hch@infradead.org>,
	"agordeev@linux.ibm.com" <agordeev@linux.ibm.com>,
	"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
	"schnelle@linux.ibm.com" <schnelle@linux.ibm.com>,
	"David.Laight@ACULAB.COM" <David.Laight@aculab.com>,
	"shorne@gmail.com" <shorne@gmail.com>,
	Vineet Gupta <vgupta@kernel.org>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>
Subject: Re: [PATCH v3 05/11] arc: mm: Convert to GENERIC_IOREMAP
Date: Thu, 13 Oct 2022 17:51:33 +0800	[thread overview]
Message-ID: <Y0ffpSdpAcvbXDGK@MiWiFi-R3L-srv> (raw)
In-Reply-To: <bbfa1fd5-3dae-2d00-0421-5f1e627eb8f7@csgroup.eu>

On 10/12/22 at 10:17am, Christophe Leroy wrote:
......
> > -/*
> > - * ioremap with access flags
> > - * Cache semantics wise it is same as ioremap - "forced" uncached.
> > - * However unlike vanilla ioremap which bypasses ARC MMU for addresses in
> > - * ARC hardware uncached region, this one still goes thru the MMU as caller
> > - * might need finer access control (R/W/X)
> > - */
> > -void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
> > -			   unsigned long flags)
> > +void __iomem *
> > +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
> >   {
> > -	unsigned int off;
> > -	unsigned long vaddr;
> > -	struct vm_struct *area;
> > -	phys_addr_t end;
> > -	pgprot_t prot = __pgprot(flags);
> > -
> > -	/* Don't allow wraparound, zero size */
> > -	end = paddr + size - 1;
> > -	if ((!size) || (end < paddr))
> > -		return NULL;
> > -
> >   	/* An early platform driver might end up here */
> >   	if (!slab_is_available())
> > -		return NULL;
> > +		return IOMEM_ERR_PTR(-EINVAL);
> 
> I think the slab_is_available() check should be done in the generic 
> functions. On all architectures SLAB must be available before you can 
> use get_vm_area_caller() and vunmap()

Tend to agree.

W/o slab initialized, the get_vm_area_caller() calling definitely will
fail. The arch's early ioremap code could call into this.


_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

WARNING: multiple messages have this Message-ID (diff)
From: Baoquan He <bhe@redhat.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"hch@infradead.org" <hch@infradead.org>,
	"agordeev@linux.ibm.com" <agordeev@linux.ibm.com>,
	"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
	"schnelle@linux.ibm.com" <schnelle@linux.ibm.com>,
	"David.Laight@ACULAB.COM" <David.Laight@aculab.com>,
	"shorne@gmail.com" <shorne@gmail.com>,
	Vineet Gupta <vgupta@kernel.org>,
	"linux-snps-arc@lists.infradead.org"
	<linux-snps-arc@lists.infradead.org>
Subject: Re: [PATCH v3 05/11] arc: mm: Convert to GENERIC_IOREMAP
Date: Thu, 13 Oct 2022 17:51:33 +0800	[thread overview]
Message-ID: <Y0ffpSdpAcvbXDGK@MiWiFi-R3L-srv> (raw)
In-Reply-To: <bbfa1fd5-3dae-2d00-0421-5f1e627eb8f7@csgroup.eu>

On 10/12/22 at 10:17am, Christophe Leroy wrote:
......
> > -/*
> > - * ioremap with access flags
> > - * Cache semantics wise it is same as ioremap - "forced" uncached.
> > - * However unlike vanilla ioremap which bypasses ARC MMU for addresses in
> > - * ARC hardware uncached region, this one still goes thru the MMU as caller
> > - * might need finer access control (R/W/X)
> > - */
> > -void __iomem *ioremap_prot(phys_addr_t paddr, unsigned long size,
> > -			   unsigned long flags)
> > +void __iomem *
> > +arch_ioremap(phys_addr_t *paddr, size_t size, unsigned long *prot_val)
> >   {
> > -	unsigned int off;
> > -	unsigned long vaddr;
> > -	struct vm_struct *area;
> > -	phys_addr_t end;
> > -	pgprot_t prot = __pgprot(flags);
> > -
> > -	/* Don't allow wraparound, zero size */
> > -	end = paddr + size - 1;
> > -	if ((!size) || (end < paddr))
> > -		return NULL;
> > -
> >   	/* An early platform driver might end up here */
> >   	if (!slab_is_available())
> > -		return NULL;
> > +		return IOMEM_ERR_PTR(-EINVAL);
> 
> I think the slab_is_available() check should be done in the generic 
> functions. On all architectures SLAB must be available before you can 
> use get_vm_area_caller() and vunmap()

Tend to agree.

W/o slab initialized, the get_vm_area_caller() calling definitely will
fail. The arch's early ioremap code could call into this.



  reply	other threads:[~2022-10-13  9:51 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-09 10:31 [PATCH v3 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Baoquan He
2022-10-09 10:31 ` [PATCH v3 01/11] hexagon: mm: Convert to GENERIC_IOREMAP Baoquan He
2022-10-09 16:39   ` Christophe Leroy
2022-10-10  0:17     ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 02/11] openrisc: mm: remove unneeded early ioremap code Baoquan He
2022-10-09 10:31   ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 03/11] mm/ioremap: change the return value of io[re|un]map_allowed and rename Baoquan He
2022-10-09 10:31   ` Baoquan He
2022-10-09 11:13   ` Kefeng Wang
2022-10-09 11:13     ` Kefeng Wang
2022-10-10  0:25     ` Baoquan He
2022-10-10  0:25       ` Baoquan He
2022-10-10  0:55       ` Kefeng Wang
2022-10-10  0:55         ` Kefeng Wang
2022-10-09 10:31 ` [PATCH v3 04/11] mm: ioremap: allow ARCH to have its own ioremap definition Baoquan He
2022-10-09 10:31 ` [PATCH v3 05/11] arc: mm: Convert to GENERIC_IOREMAP Baoquan He
2022-10-09 10:31   ` Baoquan He
2022-10-12 10:17   ` Christophe Leroy
2022-10-12 10:17     ` Christophe Leroy
2022-10-13  9:51     ` Baoquan He [this message]
2022-10-13  9:51       ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 06/11] ia64: " Baoquan He
2022-10-09 10:31   ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 07/11] openrisc: " Baoquan He
2022-10-09 10:31   ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 08/11] parisc: " Baoquan He
2022-10-09 10:31 ` [PATCH v3 09/11] s390: " Baoquan He
2022-10-09 13:54   ` kernel test robot
2022-10-10 10:38     ` Baoquan He
2022-10-10 10:38       ` Baoquan He
2022-10-10 11:53       ` Niklas Schnelle
2022-10-10 11:53         ` Niklas Schnelle
2022-10-11  3:00         ` Baoquan He
2022-10-11  3:00           ` Baoquan He
2022-10-11 15:16   ` Niklas Schnelle
2022-10-12  5:52     ` Baoquan He
2022-10-12  7:37       ` Niklas Schnelle
2022-10-12  9:20         ` Baoquan He
2022-10-09 10:31 ` [PATCH v3 10/11] sh: " Baoquan He
2022-10-09 14:16   ` kernel test robot
2022-10-09 10:31 ` [PATCH v3 11/11] xtensa: " Baoquan He
2022-10-09 16:12   ` kernel test robot
2022-10-10  2:47     ` Baoquan He
2022-10-10  2:47       ` Baoquan He
2022-10-12 10:08 ` [PATCH v3 00/11] mm: ioremap: Convert architectures to take GENERIC_IOREMAP way Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y0ffpSdpAcvbXDGK@MiWiFi-R3L-srv \
    --to=bhe@redhat.com \
    --cc=David.Laight@aculab.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=schnelle@linux.ibm.com \
    --cc=shorne@gmail.com \
    --cc=vgupta@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.