Re: pci-arbiter: Implement mapping for ROM files

2022-08-16 Thread Samuel Thibault
Joan Lledó, le mar. 16 août 2022 18:44:40 +0200, a ecrit: > El 16/8/22 a les 18:10, Samuel Thibault ha escrit: > > ? Any memory allocated by a process will be freed when the process shuts > > down. > > Yes, I know, just wondering if there was a good practice about malloc/free > in the Hurd. For

Re: pci-arbiter: Implement mapping for ROM files

2022-08-16 Thread Joan Lledó
Hi, El 16/8/22 a les 18:10, Samuel Thibault ha escrit: ? Any memory allocated by a process will be freed when the process shuts down. Yes, I know, just wondering if there was a good practice about malloc/free in the Hurd.

Re: pci-arbiter: Implement mapping for ROM files

2022-08-16 Thread Samuel Thibault
Joan Lledó, le mar. 16 août 2022 10:38:28 +0200, a ecrit: > I just though... shouldn't this allocated memory be freed somewhere when the > arbiter shuts down? ? Any memory allocated by a process will be freed when the process shuts down. Samuel

Re: pci-arbiter: Implement mapping for ROM files

2022-08-16 Thread Joan Lledó
Hi, I just though... shouldn't this allocated memory be freed somewhere when the arbiter shuts down? El 15/8/22 a les 20:33, Samuel Thibault ha escrit: Samuel Thibault, le lun. 15 août 2022 20:20:16 +0200, a ecrit: Joan Lledó, le lun. 15 août 2022 20:07:09 +0200, a ecrit: El 15/8/22 a les

Re: pci-arbiter: Implement mapping for ROM files

2022-08-15 Thread Samuel Thibault
Samuel Thibault, le lun. 15 août 2022 20:20:16 +0200, a ecrit: > Joan Lledó, le lun. 15 août 2022 20:07:09 +0200, a ecrit: > > El 15/8/22 a les 19:37, Samuel Thibault ha escrit: > > > Mmm, but doesn't libpciaccess allow to map the BAR?Then pci-arbiter > > > could create a read-only memory proxy of

Re: pci-arbiter: Implement mapping for ROM files

2022-08-15 Thread Joan Lledó
Hi, El 15/8/22 a les 20:20, Samuel Thibault ha escrit: Sorry, I meant: why can't we do that for ROMs? Does libpciaccess not provide a way to map ROMs? That's the problem: it doesn't. It only provides the function pci_device_read_rom() which copies the entire ROM to a given pointer. But it

Re: pci-arbiter: Implement mapping for ROM files

2022-08-15 Thread Samuel Thibault
Joan Lledó, le lun. 15 août 2022 20:07:09 +0200, a ecrit: > El 15/8/22 a les 19:37, Samuel Thibault ha escrit: > > Mmm, but doesn't libpciaccess allow to map the BAR?Then pci-arbiter > > could create a read-only memory proxy of the mapping? > > Yes, the arbiter exposes the BAR regions as files

Re: pci-arbiter: Implement mapping for ROM files

2022-08-15 Thread Joan Lledó
Hi, El 15/8/22 a les 19:37, Samuel Thibault ha escrit: Mmm, but doesn't libpciaccess allow to map the BAR?Then pci-arbiter could create a read-only memory proxy of the mapping? Yes, the arbiter exposes the BAR regions as files called "region0", "region1", etc. And they can be mapped through

Re: pci-arbiter: Implement mapping for ROM files

2022-08-15 Thread Samuel Thibault
Hello, Joan Lledó, le lun. 15 août 2022 18:15:19 +0200, a ecrit: > This has the obvious drawback of each arbiter instance having to copy all > devices ROMs into its space. It would be better to get the ROM physical > address somehow and map it into the arbiter space the same way we do for BAR

pci-arbiter: Implement mapping for ROM files

2022-08-15 Thread Joan Lledó
Helllo Hurd, I wrote a patch to allow mapping ROM files from the arbiter file system. In order to achieve this, the arbiter first allocates and copies the entire device ROM in its space the first time it's accessed, and returns a proxy to that memory region when a client requests a ROM