From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, "Gonglei (Arei)" <arei.gonglei@huawei.com>,
"zhenwei pi" <zhenwei.pi@linux.dev>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Amit Shah" <amit@kernel.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"John Snow" <jsnow@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
qemu-block@nongnu.org, devel@lists.libvirt.org,
"Fabiano Rosas" <farosas@suse.de>
Subject: Re: [PATCH v2 6/8] tests/qtest: add test case for fdc sector overflow
Date: Mon, 24 Aug 2026 17:01:48 +0100 [thread overview]
Message-ID: <87pkz7qzgz.fsf@draig.linaro.org> (raw)
In-Reply-To: <aoxjLcRuc7sHnIPz@redhat.com> ("Daniel P. Berrangé"'s message of "Mon, 24 Aug 2026 16:28:45 +0100")
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Mon, Aug 24, 2026 at 04:24:53PM +0100, Alex Bennée wrote:
>> Add a test case for #3800 where we check that the last sector is
>> properly bounded by the physical media that is inserted.
>>
>> Link: https://gitlab.com/qemu-project/qemu/-/issues/3800
>> AI-used-for: initial draft of test
>
> Wasn't the change in AI policy still pending a new patch
> proposal from Paolo ?
Yes it is, however given I was rushed and am not super familiar with the
fdc qtest code I took a shortcut to get something posted. FWIW it's mostly
as the original prompt created apart from:
- I added the TEST_IMAGE_xxx changes
- I suggested fake_lastsect/fake_getsect naming over the original suggestion
- I asked it to expand the comments on using RESTORE/SAVE after
consulting the datasheet myself when reviewing the code
Think of it as a road test for the proposal...
>
<snip>
>>
>> -#define TEST_IMAGE_SIZE 1440 * 1024
>> +#define TEST_IMAGE_1440KB (1440 * 1024)
>> +#define TEST_IMAGE_720KB (720 * 1024)
>>
<snip>
>>
>> +/*
>> + * Query cur_drv->last_sect using the SAVE command (CMD_SAVE, 0x2e).
>> + * Byte 8 of the 15 result bytes returned by CMD_SAVE holds last_sect.
>> + */
>> +static uint8_t get_lastsect(void)
>> +{
>> + uint8_t res[15];
>> + int i;
>> +
>> + floppy_send(CMD_SAVE);
>> + for (i = 0; i < 15; i++) {
>> + res[i] = floppy_recv();
>> + }
>> + return res[8];
>> +}
>> +
>> +/*
>> + * Attempt to set cur_drv->last_sect directly using the RESTORE command
>> + * (CMD_RESTORE, 0x4e).
>> + * While the 82078 datasheet describes RESTORE for restoring a previously
>> + * saved state, a guest can issue raw RESTORE commands with arbitrary
>> + * parameters without having issued SAVE. Parameter byte 9 is used by the
>> + * controller to restore cur_drv->last_sect.
>> + */
>> +static void fake_lastsect(uint8_t last_sect)
>> +{
>> + floppy_send(CMD_RESTORE);
>> + floppy_send(0); /* fifo[1] */
>> + floppy_send(0); /* fifo[2] */
>> + floppy_send(0); /* fifo[3]: drv0 track */
>> + floppy_send(0); /* fifo[4]: drv1 track */
>> + floppy_send(0); /* fifo[5]: drv2 track */
>> + floppy_send(0); /* fifo[6]: drv3 track */
>> + floppy_send(0); /* fifo[7]: timer0 */
>> + floppy_send(0); /* fifo[8]: timer1 */
>> + floppy_send(last_sect); /* fifo[9]: last_sect */
>> + floppy_send(0); /* fifo[10]: lock/perpendicular */
>> + floppy_send(0); /* fifo[11]: config */
>> + floppy_send(0); /* fifo[12]: precomp_trk */
>> + floppy_send(0); /* fifo[13]: pwrd */
>> + floppy_send(0); /* fifo[14] */
>> + floppy_send(0); /* fifo[15] */
>> + floppy_send(0); /* fifo[16] */
>> + floppy_send(0); /* fifo[17] */
>> +}
>> +
<snip>
>>
>> - /* Create a temporary raw image */
>> + /* Create temporary raw images */
>> fd = g_file_open_tmp("qtest.XXXXXX", &test_image, NULL);
>> g_assert(fd >= 0);
>> - ret = ftruncate(fd, TEST_IMAGE_SIZE);
>> + ret = ftruncate(fd, TEST_IMAGE_1440KB);
>> + g_assert(ret == 0);
>> + close(fd);
>> +
>> + fd = g_file_open_tmp("qtest720.XXXXXX", &test_image_720k, NULL);
>> + g_assert(fd >= 0);
>> + ret = ftruncate(fd, TEST_IMAGE_720KB);
>> g_assert(ret == 0);
>> close(fd);
<snip>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2026-08-24 16:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 15:24 [PATCH v2 0/8] various fixes for 11.2 (gitlab, tests, char-fe, fdc, mailmap, deprecations) pre-PR Alex Bennée
2026-08-24 15:24 ` [PATCH v2 1/8] gitlab: use .base_meson_job_template for macOS jobs Alex Bennée
2026-08-24 15:24 ` [PATCH v2 2/8] tests/arm: add explicit CFLAGS for system build Alex Bennée
2026-08-24 15:24 ` [PATCH v2 3/8] gitlab: add arm-softmmu tests to the macOS build Alex Bennée
2026-08-24 21:28 ` Philippe Mathieu-Daudé
2026-08-25 9:09 ` Alex Bennée
2026-08-24 15:24 ` [PATCH v2 4/8] char-fe: implement qemu_chr_fe_backend_name Alex Bennée
2026-08-24 15:24 ` [PATCH v2 5/8] hw/block: validate the fdc sector position fits within bounds Alex Bennée
2026-08-24 15:24 ` [PATCH v2 6/8] tests/qtest: add test case for fdc sector overflow Alex Bennée
2026-08-24 15:28 ` Daniel P. Berrangé
2026-08-24 16:01 ` Alex Bennée [this message]
2026-08-24 15:24 ` [PATCH v2 7/8] docs: deprecate virtio-crypto Alex Bennée
2026-09-04 14:38 ` Michael S. Tsirkin
2026-08-24 15:24 ` [PATCH v2 8/8] mailmap: map the last From-munged author back to a real identity Alex Bennée
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=87pkz7qzgz.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=amit@kernel.org \
--cc=arei.gonglei@huawei.com \
--cc=berrange@redhat.com \
--cc=devel@lists.libvirt.org \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@mailo.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.com \
--cc=zhenwei.pi@linux.dev \
/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.