[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT PATCH RFC v2 3/7] plat/common: Introduce new platform bus


  • To: Julien Grall <Julien.Grall@xxxxxxx>, "minios-devel@xxxxxxxxxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Justin He (Arm Technology China)" <Justin.He@xxxxxxx>
  • Date: Fri, 25 Oct 2019 00:12:30 +0000
  • Accept-language: en-US, zh-CN
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TPULE8BGtYPDmFgj6qc42d85ZS2HEHzb0eHLOnMgKZg=; b=E+Ju0p96iKi5duxtS88I8TauLRsmJNd9v0zwR1VTt1r0Lezzx77bIrcGscB3E30zRhlSUbzY/7KWXF59trTNOJYdfVjz5Ckt6jB1Vydmv9wciYcuWJmo9n8mFUz1cJkvrrTn15V6wRRwrmAHuQsFJ83kRpWAqm6Jqw/jgN7sysw+eAdZMLNeNdUFhc4w77bBFvrvPNOCxf/bWLj5HlaCfXAhQz8LCikhpGD4Ty8pMRvJ3wvX/8fhUPJBcPVkjPHSs90Eh4V4C4z2ZFPtFDrc0Zd2zkPVpe+clx5UvD7e02AFI8qkSW9L34SPDckuWHSfNVWNsNK05xe84zO2bbG9RQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nZOoT2B8LxTsktJxcpGQ4zpoZ1KouzTcPnCemysJaAjqym/JNy0DHSDr4d28Ud4F/GQ3DRvlMiZlshzNgt81GbakHfMszAWXLnhOa2UcEWwtsB2j2D6aD7JANsqiTssI3lRc3Ft+3RXlGAeekcX1YO9CEZfOFLpOPShG2FXcd28dzUG0jak5PlLkMblY4Ji+iQZti8k/JuKAB8zuKbPFhdMoqCi+6XZrPwrSdQ92Wh3SAk9+okfcNOBVpfjqwj55X7PQ7eqGCLVq/07xWaVVPey0Nwd/ArBoC5yXKe0AMHuMf5ly11waGeGiZYWNzFHExxOm/1RtIB5D4c7hwTSSqA==
  • Authentication-results: spf=fail (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xenproject.org; dmarc=none action=none header.from=arm.com;
  • Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Justin.He@xxxxxxx;
  • Cc: Felipe Huici <felipe.huici@xxxxxxxxx>, "Kaly Xin \(Arm Technology China\)" <Kaly.Xin@xxxxxxx>, "Sharan.Santhanam@xxxxxxxxx" <Sharan.Santhanam@xxxxxxxxx>, "Santiago.Pagani@xxxxxxxxx" <Santiago.Pagani@xxxxxxxxx>, Simon Kuenzer <simon.kuenzer@xxxxxxxxx>, nd <nd@xxxxxxx>
  • Delivery-date: Fri, 25 Oct 2019 00:12:47 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Justin.He@xxxxxxx;
  • Thread-index: AQHViXb9qJnXPaTjukiTZlmhnVU6jKdpE/sAgABlAYCAAAVA4A==
  • Thread-topic: [UNIKRAFT PATCH RFC v2 3/7] plat/common: Introduce new platform bus

Hi Julien

> -----Original Message-----
> From: Julien Grall <julien.grall@xxxxxxx>
> Sent: Thursday, October 24, 2019 4:35 PM
> To: Justin He (Arm Technology China) <Justin.He@xxxxxxx>; minios-
> devel@xxxxxxxxxxxxxxxxxxxx; Santiago.Pagani@xxxxxxxxx
> Cc: nd <nd@xxxxxxx>; Simon Kuenzer <simon.kuenzer@xxxxxxxxx>;
> Sharan.Santhanam@xxxxxxxxx; Felipe Huici <felipe.huici@xxxxxxxxx>; Kaly
> Xin (Arm Technology China) <Kaly.Xin@xxxxxxx>
> Subject: Re: [UNIKRAFT PATCH RFC v2 3/7] plat/common: Introduce new
> platform bus
> 
> Hi,
> 
> On 10/24/19 5:55 AM, Justin He (Arm Technology China) wrote:
> >>> +
> >>> +drv = pf_find_driver(&devid);
> >>> +if (!drv) {
> >>> +uk_pr_info("<no driver>\n");
> >>> +return -ENODEV;
> >>> +}
> >>> +
> >>> +uk_pr_info("driver %p\n", drv);
> >>> +
> >>> +/* qemu creates virtio devices in reverse order */
> >>
> >> Why the order matters here? What's going to happen if you are using a
> >> different backend that will chose a different order?
> >
> > Please see the create_virtio_devices() in qemu codes
> >      for (i = 0; i < NUM_VIRTIO_TRANSPORTS; i++) {
> >          int irq = vms->irqmap[VIRT_MMIO] + i;
> >          hwaddr base = vms->memmap[VIRT_MMIO].base + i * size;
> >
> >          sysbus_create_simple("virtio-mmio", base, pic[irq]);
> >      }
> >
> >      /* We add dtb nodes in reverse order so that they appear in the
> finished
> >       * device tree lowest address first.
> >       *
> >       * Note that this mapping is independent of the loop above. The
> previous
> >       * loop influences virtio device to virtio transport assignment, 
> > whereas
> >       * this loop controls how virtio transports are laid out in the dtb.
> >       */
> >      for (i = NUM_VIRTIO_TRANSPORTS - 1; i >= 0; i--) {
> >
> > So qemu ^ will create max (32) virtio mmio devices and in reverse order.
> 
> This tells me what QEMU does *not* why Unikraft needs to do it.
> 
> AFAICT, both Linux and FreeBSD does need to search for virtio,mmio node
> in reverse order. So why does Unikraft need it? In other word, what will
> happen if you do the "wrong" way?

Sorry, I don't quite understand your concerns here.
If Unikraft didn’t search it in reverse order, how can it probe the correct 
Virtio-mmio device? Could you please elaborate it more, thanks

> >
> >>
> >>> +for (i = 0; i < UK_MAX_VIRTIO_MMIO_DEVICE; i++) {
> >>
> >> So if you have more than UK_MAX_VIRTIO_MMIO_DEVICE, the rest will be
> >> ignored. Don't you want to at least warn the users if there are more
> >> than what we can support?
> >
> > Ok, I will add the warning if the number is larger than 32.
> >>
> >>> +end_offset = fdt_get_last_node_by_compatible(fdt,
> >>> +end_offset,
> >>> +pf_device_list[0]);
> >>> +if (end_offset == -FDT_ERR_NOTFOUND) {
> >>> +uk_pr_info("device not found in fdt\n");
> >>> +goto error_exit;
> >>> +} else {
> >>> +prop = fdt_getprop(fdt, end_offset, "interrupts",
> >>> +   &prop_len);
> >>> +if (!prop) {
> >>> +uk_pr_err("irq of device not found in fdt\n");
> >>> +goto error_exit;
> >>> +}
> >>> +
> >>> +type = fdt32_to_cpu(prop[0]);
> >>> +hwirq = fdt32_to_cpu(prop[1]);
> >>> +
> >>> +prop = fdt_getprop(fdt, end_offset, "reg", &prop_len);
> >>> +if (!prop) {
> >>> +uk_pr_err("reg of device not found in fdt\n");
> >>> +goto error_exit;
> >>> +}
> >>> +
> >>> +/* only care about base addr, ignore the size */
> >>> +reg_base = fdt32_to_cpu(prop[0]);
> >>> +reg_base = reg_base << 32 | fdt32_to_cpu(prop[1]);
> >>
> >> What happen if the address is described as a 32-bit only value? I
> >> thought we introduced helpers for that.
> >
> > It is problematic, thanks. I will consider to use fdt_get_address helper.
> >
> >>
> >>
> >>> +}
> >>> +
> >>> +dev_base = reg_base;
> >>> +dev_irq = gic_irq_translate(type, hwirq);
> >>
> >> I can't find this function in the main Unikraft repo. What is it based on?
> >
> > It is at
> http://xenbits.xenproject.org/gitweb/?p=unikraft/unikraft.git;a=blob;f=plat/
> drivers/gic/gic-
> v2.c;h=c01c92f6368c09ba8e405584bea44d66b0a1620d;hb=refs/heads/staging
> #l294
> 
> Thanks, so Unikraft has no helper to get the interrupt and the type from
> at DT at the same time, right? If so, I think it would be worth
> considering it as you usually needs the type in hand to configure your
> interrupt.

Ok, I can provide a new helper to get the hwirq and type at the same time.

--
Cheers,
Justin (Jia He)


> 
> Cheers,
> 
> --
> Julien Grall
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.