qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] block: handle "rechs" and "large" translation options
@ 2014-01-30 15:57 Paolo Bonzini
  2014-01-31  8:07 ` Markus Armbruster
  2014-01-31 15:00 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-01-30 15:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, armbru, stefanha

Sure, CHS translation is an obscure topic, and legacy options for
hard-disk geometries are obscure as well.  But since QEMU does nothing
with it except telling the BIOS, and since there "large" and "rechs"
are listed in the enums, parsing them seems to be the bare minimum.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 blockdev.c |  4 ++++
 vl.c       | 22 ++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 36ceece..d71f815 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -776,6 +776,10 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
             translation = BIOS_ATA_TRANSLATION_NONE;
         } else if (!strcmp(value, "lba")) {
             translation = BIOS_ATA_TRANSLATION_LBA;
+        } else if (!strcmp(value, "large")) {
+            translation = BIOS_ATA_TRANSLATION_LARGE;
+        } else if (!strcmp(value, "rechs")) {
+            translation = BIOS_ATA_TRANSLATION_RECHS;
         } else if (!strcmp(value, "auto")) {
             translation = BIOS_ATA_TRANSLATION_AUTO;
         } else {
diff --git a/vl.c b/vl.c
index 7f4fe0d..46112af 100644
--- a/vl.c
+++ b/vl.c
@@ -3053,14 +3053,19 @@ int main(int argc, char **argv, char **envp)
                         goto chs_fail;
                     if (*p == ',') {
                         p++;
-                        if (!strcmp(p, "none"))
+                        if (!strcmp(p, "large")) {
+                            translation = BIOS_ATA_TRANSLATION_LARGE;
+                        } else if (!strcmp(p, "rechs")) {
+                            translation = BIOS_ATA_TRANSLATION_RECHS;
+                        } else if (!strcmp(p, "none")) {
                             translation = BIOS_ATA_TRANSLATION_NONE;
-                        else if (!strcmp(p, "lba"))
+                        } else if (!strcmp(p, "lba")) {
                             translation = BIOS_ATA_TRANSLATION_LBA;
-                        else if (!strcmp(p, "auto"))
+                        } else if (!strcmp(p, "auto")) {
                             translation = BIOS_ATA_TRANSLATION_AUTO;
-                        else
+                        } else {
                             goto chs_fail;
+                        }
                     } else if (*p != '\0') {
                     chs_fail:
                         fprintf(stderr, "qemu: invalid physical CHS format\n");
@@ -3074,10 +3079,15 @@ int main(int argc, char **argv, char **envp)
                         qemu_opt_set(hda_opts, "heads", num);
                         snprintf(num, sizeof(num), "%d", secs);
                         qemu_opt_set(hda_opts, "secs", num);
-                        if (translation == BIOS_ATA_TRANSLATION_LBA)
+                        if (translation == BIOS_ATA_TRANSLATION_LARGE) {
+                            qemu_opt_set(hda_opts, "trans", "large");
+                        } else if (translation == BIOS_ATA_TRANSLATION_RECHS) {
+                            qemu_opt_set(hda_opts, "trans", "rechs");
+                        } else if (translation == BIOS_ATA_TRANSLATION_LBA) {
                             qemu_opt_set(hda_opts, "trans", "lba");
-                        if (translation == BIOS_ATA_TRANSLATION_NONE)
+                        } else if (translation == BIOS_ATA_TRANSLATION_NONE) {
                             qemu_opt_set(hda_opts, "trans", "none");
+                        }
                     }
                 }
                 break;
-- 
1.8.4.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] block: handle "rechs" and "large" translation options
  2014-01-30 15:57 [Qemu-devel] [PATCH v2] block: handle "rechs" and "large" translation options Paolo Bonzini
@ 2014-01-31  8:07 ` Markus Armbruster
  2014-01-31 15:00 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Armbruster @ 2014-01-31  8:07 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kwolf, qemu-devel, stefanha

Paolo Bonzini <pbonzini@redhat.com> writes:

> Sure, CHS translation is an obscure topic, and legacy options for
> hard-disk geometries are obscure as well.  But since QEMU does nothing
> with it except telling the BIOS, and since there "large" and "rechs"
> are listed in the enums, parsing them seems to be the bare minimum.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

This is semantically on top of "[PATCH 00/12] qdev: cleanup legacy
properties", which adds these two values to isa-hd property
bios-chs-trans.  Here, you add them to the two obsolete ways to specify
the property.  While I don't think that's necessary, I don't object to
it either.

Despite my doubts on the need for the patch:

Reviewed-by: Markus Armbruster <armbru@redhat.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] block: handle "rechs" and "large" translation options
  2014-01-30 15:57 [Qemu-devel] [PATCH v2] block: handle "rechs" and "large" translation options Paolo Bonzini
  2014-01-31  8:07 ` Markus Armbruster
@ 2014-01-31 15:00 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2014-01-31 15:00 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kwolf, qemu-devel, armbru

On Thu, Jan 30, 2014 at 04:57:25PM +0100, Paolo Bonzini wrote:
> Sure, CHS translation is an obscure topic, and legacy options for
> hard-disk geometries are obscure as well.  But since QEMU does nothing
> with it except telling the BIOS, and since there "large" and "rechs"
> are listed in the enums, parsing them seems to be the bare minimum.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  blockdev.c |  4 ++++
>  vl.c       | 22 ++++++++++++++++------
>  2 files changed, 20 insertions(+), 6 deletions(-)

Acked-by: Stefan Hajnoczi <stefanha@gmail.com>

Feel free to squash into your other series.

(Please consider doing a separate patch with the documentation updates I
mentioned in response to v1.)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-31 15:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30 15:57 [Qemu-devel] [PATCH v2] block: handle "rechs" and "large" translation options Paolo Bonzini
2014-01-31  8:07 ` Markus Armbruster
2014-01-31 15:00 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).