# AHCI Driver Partition Setup in QEMU/Hardware

**URL:** <https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97>\
**Category:** Developer's Corner\
**Created:** [October 12, 2024, 10:42am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97 "2024-10-12T10:42:57Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://genode.discourse.group/u/hamed)\
**Post date:** [October 12, 2024, 10:42am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/1 "2024-10-12T10:42:57Z")

</div>

I have enabled dynamic settings, but one of the issues I encountered is the storage of information for use in the next system boot. To address this, after reviewing existing sample applications, I arrived at the following structure:

```xml
<start name="report_rom">
	<resource name="RAM" quantum="2M"/>
	<provides> <service name="Report"/> <service name="ROM"/> </provides>
	<config>
		<policy label="pci_decode -> system" report="acpi_drv -> acpi"/>
		<policy label="platform_drv -> devices" report="pci_decode -> devices"/>
	</config>
</start>

<start name="acpi_drv" caps="350">
	<resource name="RAM" quantum="4M"/>
	<route>
		<service name="Report"> <child name="report_rom"/> </service>
	</route>
</start>

<start name="pci_decode" caps="350">
	<resource name="RAM" quantum="2M"/>
	<route>
		<service name="Report"> <child name="report_rom"/> </service>
		<service name="ROM" label="system"> <child name="report_rom"/> </service>
	</route>
</start>

<start name="platform_drv" caps="100" managing_system="yes">
	<resource name="RAM" quantum="1M"/>
	<provides> <service name="Platform"/> </provides>
	<route>
		<service name="ROM" label="devices"> <child name="report_rom"/> </service>
		<service name="Report"> <child name="report_rom"/> </service>	</route>
	<config>
		<report devices="yes"/>
		<policy label="ahci_drv -> "> <pci class="AHCI"/> </policy>
	</config>
</start>

<start name="ahci_drv" caps="300">
	<resource name="RAM" quantum="12M" />
	<provides><service name="Block" /></provides>
	<config atapi="yes">
		<report ports="yes"/>
		<vfs>
			<ram/>
			<import>
				<rom name="ext2.raw"/>
			</import>
		</vfs>
		<default-policy root="/" file="ext2.raw" block_size="512" writeable="yes"/>
		<policy label="ahci_fs -> " device="1" writeable="yes"/>
	</config>
	<route>
		<service name="Report"> <child name="ahci_report_rom"/> </service>
		<any-service> <parent /> <any-child/> </any-service>
	</route>
</start>

<start name="ahci_report_rom">
	<binary name="report_rom"/>
	<resource name="RAM" quantum="1M"/>
	<provides> <service name="Report"/> <service name="ROM"/> </provides>
	<config verbose="yes"/>
</start>

```

This sample configuration is functional for testing with QEMU, adding an AHCI driver, and utilizing an `ext2.raw` partition. However, on actual hardware, there is a step missing: the partitioning needs to occur in such a way that I can reference it in the `ahci_drv` module. Without this, I encounter the following error:

```auto
[init -> ahci_fs] Error: Mounting 'ext2fs' file system failed (13)
[init -> ahci_fs] Error: failed to create <rump> VFS node
[init -> ahci_fs] Error: fs="ext2fs"
[init -> ahci_fs] Error: ram="48M"
[init -> ahci_fs] Error: writeable="yes"

```

What module should I add to this set of modules to create and correctly name the partition so that I can use the file system structure on the hard disk?

---

<div class="post-metadata">

**Author:** ![chelmuth](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/chelmuth/32/1_2.png) [@chelmuth](https://genode.discourse.group/u/chelmuth)\
**Post date:** [October 12, 2024, 1:20pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/2 "2024-10-12T13:20:56Z")

</div>

The part\_block component parses DOS/GPT partition tables and provides dedicated block sessions for partitions as well as the whole disk.

---

<div class="post-metadata">

**Author:** ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://genode.discourse.group/u/hamed)\
**Post date:** [October 15, 2024, 6:32am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/3 "2024-10-15T06:32:02Z")

</div>

Thank you, I had seen this component in the Sculpt OS code but was unsure about it. Your guidance led me to conduct a more thorough investigation, and it worked out.

I just have another question. My test system also has a mini SATA drive, which is connected via the same AHCI controller. However, the Genode driver can’t detect it. Have you encountered this issue?

Note: My device doesn’t have a serial output, and although I enabled the terminal log, it still doesn’t display the driver logs. Therefore, I don’t have a clear output to share the error with you.

---

<div class="post-metadata">

**Author:** ![chelmuth](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/chelmuth/32/1_2.png) [@chelmuth](https://genode.discourse.group/u/chelmuth)\
**Post date:** [October 23, 2024, 7:13am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/4 "2024-10-23T07:13:38Z")

</div>

> [@hamed](#):
>
> I just have another question. My test system also has a mini SATA drive, which is connected via the same AHCI controller. However, the Genode driver can’t detect it. Have you encountered this issue?
> 
> Note: My device doesn’t have a serial output, and although I enabled the terminal log, it still doesn’t display the driver logs. Therefore, I don’t have a clear output to share the error with you.

Sorry for my late reply, but I do not have tips to enable this drive. May you send more information about this _mini SATA drive_? You could use a Live Linux and lshw, smartctl, journalctl etc. Also, the parts of /report/log in Sculpt OS concerning _ahci_ may be of help.

---

<div class="post-metadata">

**Author:** ![ttcoder](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/ttcoder/32/9_2.png) [@ttcoder](https://genode.discourse.group/u/ttcoder)\
**Post date:** [October 23, 2024, 9:54am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/5 "2024-10-23T09:54:41Z")

</div>

> [@hamed](#):
>
> Note: My device doesn’t have a serial output, and although I enabled the terminal log, it still doesn’t display the driver logs. Therefore, I don’t have a clear output to share the error with you.

Regarding terminal log and drivers, make sure to route the driver logs to that terminal, otherwise they get routed to the parent init, which itself will use serial output. I.e. insert something like this in the driver routes…

```auto
<route>
					<service name="LOG"> <child name="terminal....log..." /> </service>
					<any-service> <parent/> <any-child/> </any-service>
</route>

```

---

<div class="post-metadata">

**Author:** ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://genode.discourse.group/u/hamed)\
**Post date:** [November 5, 2024, 12:42pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/6 "2024-11-05T12:42:38Z")

</div>

Thank you for the suggestions and apologies for the delay in gathering the details. I’ve taken the steps you mentioned to retrieve more information on the mini SATA drive using Live Linux and Sculpt OS logs. Below are the results:

The first picture contains the hardware information of the mini SATA device, extracted through Live Linux.

 ![IMG_20241105_151033](https://europe1.discourse-cdn.com/flex006/uploads/genode/original/1X/6e3227b1e046b6c367cc42b4386615bb98a83aa7.jpeg)

This next image shows that the partitioning was completed correctly.

 ![IMG_20241105_151455](https://europe1.discourse-cdn.com/flex006/uploads/genode/original/1X/f2cb5ea6348b1b876ed7f9156f3afa289fcf8f73.jpeg)

Here is the Sculpt OS output displayed in the log section.

 ![IMG_20241105_145636](https://europe1.discourse-cdn.com/flex006/uploads/genode/original/1X/98febf5dbba9cb33c369c8754a16cec2e8c1db7c.jpeg)

And finally, this is the final output from Sculpt OS.

 ![IMG_20241105_145723](https://europe1.discourse-cdn.com/flex006/uploads/genode/original/1X/b355ebbad0d7b0cf4d535be68ae614bba584bd70.jpeg)

---

<div class="post-metadata">

**Author:** ![chelmuth](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/chelmuth/32/1_2.png) [@chelmuth](https://genode.discourse.group/u/chelmuth)\
**Post date:** [November 5, 2024, 1:17pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/7 "2024-11-05T13:17:34Z")

</div>

Thanks for the details. What bothers me most is _#0: off (ATA)_. As the device is named _/dev/sda_ in Linux I’d expect #0 is the one most interesting to us. @ssumpf do you have further ideas about the _off_ state?

Also, your screenshot misses some lines from the ahci driver startup. May you please look for those in your log and send them?

---

<div class="post-metadata">

**Author:** ![cproc](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@cproc](https://genode.discourse.group/u/cproc)\
**Post date:** [November 5, 2024, 1:18pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/8 "2024-11-05T13:18:14Z")

</div>

Could it be the same problem as in issue [ahci\_drv: devices not reported · Issue #5088 · genodelabs/genode · GitHub](https://github.com/genodelabs/genode/issues/5088)?

In that case, the following commit might help:

> <https://github.com/cproc/genode/commit/cc2536bd9a186ce904e6f52ff337ebfddfe01cef>

---

<div class="post-metadata">

**Author:** ![ssumpf](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/ssumpf/32/14_2.png) [@ssumpf](https://genode.discourse.group/u/ssumpf)\
**Post date:** [November 5, 2024, 5:56pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/9 "2024-11-05T17:56:09Z")

</div>

@cproc: Sorry, I totally missed issue 5088. @hamed: Could you give cproc’s patch a try?

---

<div class="post-metadata">

**Author:** ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://genode.discourse.group/u/hamed)\
**Post date:** [November 9, 2024, 7:24am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/10 "2024-11-09T07:24:55Z")

</div>

Thank you, Christian. Disabling the `reset()` function resolved the issue effectively.

However, there’s still a problem I’ve encountered on a low-spec system. If I delay the driver execution by showing logs, the driver runs correctly. Otherwise, both the AHCI and Realtek drivers fail to initialize, and the system freezes at that point in execution.

---

<div class="post-metadata">

**Author:** ![cproc](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@cproc](https://genode.discourse.group/u/cproc)\
**Post date:** [November 9, 2024, 1:28pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/11 "2024-11-09T13:28:09Z")

</div>

> [@hamed](#):
>
> However, there’s still a problem I’ve encountered on a low-spec system. If I delay the driver execution by showing logs, the driver runs correctly. Otherwise, both the AHCI and Realtek drivers fail to initialize, and the system freezes at that point in execution.

Is that the system with the Celeron CPU? Which Celeron is it exactly?

---

<div class="post-metadata">

**Author:** ![hamed](https://avatars.discourse-cdn.com/v4/letter/h/d6d6ee/32.png) [@hamed](https://genode.discourse.group/u/hamed)\
**Post date:** [November 12, 2024, 6:23am UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/12 "2024-11-12T06:23:31Z")

</div>

Yes, it’s a Celeron. Intel Celeron J4105.

---

<div class="post-metadata">

**Author:** ![chelmuth](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/chelmuth/32/1_2.png) [@chelmuth](https://genode.discourse.group/u/chelmuth)\
**Post date:** [November 13, 2024, 8:51pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/14 "2024-11-13T20:51:04Z")

</div>

This CPU has a single-core performance that is comparable to the Lenovo X201 from 2010 according to [Intel Celeron J4105 vs i5-520M [cpubenchmark.net] by PassMark Software](https://www.cpubenchmark.net/compare/3159vs778/Intel-Celeron-J4105-vs-Intel-i5-520M). Please keep that in mind during evaluation assessment.

---

<div class="post-metadata">

**Author:** ![G0retZ](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/g0retz/32/232_2.png) [@G0retZ](https://genode.discourse.group/u/G0retZ)\
**Post date:** [February 14, 2026, 1:10pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/15 "2026-02-14T13:10:04Z")

</div>

Hello, I’m facing the same issue running SculptOS 25.10 on my machine.

It’s a Core i3-9100 CPU on Asus Prime H310M-A motherboard.

It has 4 SATA slots and NvME (setup in PCIe mode via BIOS). So far USB and NvME storage are working fine.

But my SATA drives are not accessible: I have 3 Toshiba N300 HDDs attached, but Sculpt reports all ahci devices as `off` and doesn’t pick them up.

Is there any fix or solution for this problem?

---

<div class="post-metadata">

**Author:** ![G0retZ](https://dub1.discourse-cdn.com/flex006/user_avatar/genode.discourse.group/g0retz/32/232_2.png) [@G0retZ](https://genode.discourse.group/u/G0retZ)\
**Post date:** [April 13, 2026, 12:00pm UTC](https://genode.discourse.group/t/ahci-driver-partition-setup-in-qemu-hardware/97/16 "2026-04-13T12:00:04Z")

</div>

Hello guys!

I’ve managed to create a PR that should fix this issue once and for all.

> <https://github.com/genodelabs/genode/pull/5853>
>
> This PR is vibe-coded with thorough supervision and sanity check.
> Though I'm no…t an expert in C++ nor in drivers development.
> 
> Here is the summary of the reasoning behind the changes produced by AI:
> 
> \> On systems with an IOMMU, SATA ports were logged as "off (ATA)" at boot
> \> despite the BIOS having successfully initialized the devices.
> \> 
> \> Root cause
> \> ----------
> \> Port::reinit() unconditionally called reset() (COMRESET via PxSCTL.Det)
> \> before enable() and before setup\_memory() had mapped a Genode-owned FIS
> \> receive buffer into PxFB.
> \> 
> \> At that point PxFB still held the BIOS-allocated physical address and FRE
> \> (FIS Receive Enable) was left enabled by the BIOS. The device responded to
> \> COMRESET by posting a D2H Register FIS. The HBA attempted a DMA write to
> \> the BIOS address, which the IOMMU blocked. As a result FR (FIS Receive
> \> Running) never cleared. The subsequent setup\_memory() → wait\_for(FR=0)
> \> timed out with Polling\_timeout, which propagated out of \_scan\_ports and
> \> left the port disabled.
> \> 
> \> Fix
> \> ---
> \> Move the COMRESET out of the unconditional preamble and instead call
> \> enable() first:
> \> 
> \> - On boot and S3 resume the SATA link is already established by the BIOS /
> \> powered controller. enable() succeeds immediately and no COMRESET is
> \> needed before init().
> \> 
> \> - On S4 resume (full power loss) all port registers including PxSSTS reset
> \> to zero, so enable() returns false. In that case reset() is issued to
> \> re-establish the link. After S4, Cmd::St and FRE are guaranteed 0 by
> \> power loss, so the COMRESET cannot trigger an IOMMU-blocked DMA, and
> \> setup\_memory() inside the subsequent init() will find FR=0 immediately.
> \> 
> \> The is\_resume parameter (defaulting to false) distinguishes the two
> \> failure meanings of enable() returning false: an empty port at boot (throw
> \> immediately, DMA registers never touched) versus a link-down condition at
> \> S4 resume (reset and retry).
> \> 
> \> The resume call site in main.cc is updated to pass is\_resume=true.
> 
> Tested on my system building Sculpt from the current \`master\` branch and now I have access to all of my drives.
> !\[20260413\_112232\](https://github.com/user-attachments/assets/7f98c8d3-7bdf-4535-ac1a-669956765883)
> !\[20260413\_112216\](https://github.com/user-attachments/assets/b43d0108-fda8-460c-8200-670b4dad7bcc)

I validated it works on my setup by building Sculpt from the current `master`.

I wasn’t able to test S3 and S4 resume though (not sure ho to do this).

@ssumpf @alex-ab I kindly ask you to review it if those changes make sense and are safe 🙏

I would love to see this finally working in the next Sculpt OS release! 😄
