Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Marc Zyngier <marc.zyngier@arm.com>
To: Qais Yousef <qais.yousef@imgtec.com>,
	Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org, alex@alex-smith.me.uk,
	Alex Smith <alex.smith@imgtec.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] irqchip: irq-mips-gic: Provide function to map GIC user section
Date: Mon, 28 Sep 2015 16:03:58 +0100	[thread overview]
Message-ID: <560956DE.60402@arm.com> (raw)
In-Reply-To: <56094BCD.6000600@imgtec.com>

On 28/09/15 15:16, Qais Yousef wrote:
> On 09/28/2015 11:55 AM, Marc Zyngier wrote:
>> On 28/09/15 11:11, Markos Chandras wrote:
>>
>>> +
>>> +	pfn = (gic_base_addr + USM_VISIBLE_SECTION_OFS) >> PAGE_SHIFT;
>>> +	return io_remap_pfn_range(vma, base, pfn, size,
>>> +				  pgprot_noncached(PAGE_READONLY));
>>
>> - Does this code have to be in the irqchip driver? It really feels out
>> of place, and I'd rather see a function that returns the mappable range
>> to the VDSO code, where the mapping would occur.
>>
> 
> 
> I don't think it's a good idea either for the VDSO code to know about 
> gic_base_addr. Maybe this function could be split to return the pfn and 
> let the caller do io_remap_pfn_range(). Though I think it's nice to have 
> it all there. USM stands for USer Mode - GIC wants to make some stuff 
> visible to user mode and it puts them in that special section. So it 
> makes sense to do it all there IMO.

Maybe I wasn't clear enough. My suggestion was to expose this in
the VDSO setup code:

@@ -90,8 +133,15 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 		goto out;
 	}
 
+	/* Map GIC user page. */
+	if (gic_size) {
+		ret = gic_map_user_section(vma, base, gic_size);
+		if (ret)
+			goto out;
+	}
+

This could easily be written as:

	if (gic_size) {
		struct resource gic_res;
		ret = gic_get_usm_range(&gic_res);
		if (ret)
			goto out;
		... and perform the mapping here...
	}

You can also rewrite the hunks above to actually get the present/size
information from the GIC. And if you have DT, you should be able to
directly find the memory region there, without involving the GIC
driver at all.

I don't really fancy having some userspace visible stuff in an
interrupt controller driver, and I tend to find it nicer to split
the responsabilities: the VDSO code deals with the userspace mapping,
and the interrupt controller deals with interrupts.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  parent reply	other threads:[~2015-09-28 15:04 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 10:03 [PATCH 0/3] MIPS VDSO support Markos Chandras
2015-09-28 10:03 ` Markos Chandras
2015-09-28 10:10 ` [PATCH 1/3] MIPS: Initial implementation of a VDSO Markos Chandras
2015-09-28 10:10   ` Markos Chandras
2015-09-28 10:54   ` Alex Smith
2015-09-28 13:07     ` Matthew Fortune
2015-11-20 18:15       ` Maciej W. Rozycki
2015-10-09  8:05   ` [PATCH v2 " Markos Chandras
2015-10-09  8:05     ` Markos Chandras
2015-10-21  8:54     ` [PATCH v3 " Markos Chandras
2015-10-21  8:54       ` Markos Chandras
2015-09-28 10:11 ` [PATCH 2/3] irqchip: irq-mips-gic: Provide function to map GIC user section Markos Chandras
2015-09-28 10:11   ` Markos Chandras
2015-09-28 10:55   ` Marc Zyngier
2015-09-28 14:16     ` Qais Yousef
2015-09-28 14:16       ` Qais Yousef
2015-09-28 15:03       ` Marc Zyngier [this message]
2015-10-05  8:22     ` Markos Chandras
2015-10-05  8:22       ` Markos Chandras
2015-10-12  9:40   ` [PATCH v2 " Markos Chandras
2015-10-12  9:40     ` Markos Chandras
2015-10-12  9:51     ` Marc Zyngier
2015-10-12 10:16       ` Thomas Gleixner
2015-10-15  9:37         ` Qais Yousef
2015-10-15  9:37           ` Qais Yousef
2015-10-15 10:18           ` Thomas Gleixner
2015-09-28 10:12 ` [PATCH 3/3] MIPS: VDSO: Add implementations of gettimeofday() and clock_gettime() Markos Chandras
2015-09-28 10:12   ` Markos Chandras
2015-09-28 13:15   ` kbuild test robot
2015-09-28 13:15     ` kbuild test robot
2015-10-12 10:24   ` [PATCH v2 " Markos Chandras
2015-10-12 10:24     ` Markos Chandras
2015-10-21  8:57     ` [PATCH v3 " Markos Chandras
2015-10-21  8:57       ` Markos Chandras
2015-10-23  1:41       ` [v3, " Leonid Yegoshin
2015-10-23  1:41         ` Leonid Yegoshin
2015-10-27 14:47         ` Ralf Baechle
2015-10-27 20:46           ` Leonid Yegoshin
2015-10-27 20:46             ` Leonid Yegoshin
2015-10-27 21:02             ` David Daney
2015-10-27 21:15               ` Leonid Yegoshin
2015-10-27 21:15                 ` Leonid Yegoshin
2015-10-27 21:44                 ` David Daney
2015-10-27 21:49                   ` Leonid Yegoshin
2015-10-27 21:49                     ` Leonid Yegoshin
2015-10-28 10:20                     ` Alex Smith
2015-10-28 18:21                       ` Leonid Yegoshin
2015-10-28 18:21                         ` Leonid Yegoshin
2015-10-28 18:30                         ` Alex Smith
2015-10-28 18:57                           ` Leonid Yegoshin
2015-10-28 18:57                             ` Leonid Yegoshin
2015-10-28 19:04                             ` Alex Smith
2015-10-28 19:28                               ` Leonid Yegoshin
2015-10-28 19:28                                 ` Leonid Yegoshin
2015-10-28 19:55                                 ` Alex Smith
2015-10-28 20:15                                   ` Leonid Yegoshin
2015-10-28 20:15                                     ` Leonid Yegoshin
2016-01-25 22:36       ` [PATCH v3 " Hauke Mehrtens

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=560956DE.60402@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=alex.smith@imgtec.com \
    --cc=alex@alex-smith.me.uk \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=qais.yousef@imgtec.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox