Explorar el Código

config(qemu): limit 2 units per IDE bus to supported machines

osy hace 2 años
padre
commit
f072dced95

+ 11 - 1
Configuration/UTMQemuConfiguration+Arguments.swift

@@ -489,6 +489,16 @@ import Virtualization // for getting network interfaces
         }
     }
     
+    /// These machines are hard coded to have one IDE unit per bus in QEMU
+    private var isIdeInterfaceSingleUnit: Bool {
+        system.target.rawValue.contains("q35") ||
+        system.target.rawValue == "microvm" ||
+        system.target.rawValue == "cubieboard" ||
+        system.target.rawValue == "highbank" ||
+        system.target.rawValue == "midway" ||
+        system.target.rawValue == "xlnx_zcu102"
+    }
+    
     @QEMUArgumentBuilder private func driveArgument(for drive: UTMQemuConfigurationDrive, busInterfaceMap: inout [String: Int]) -> [QEMUArgument] {
         let isRemovable = drive.imageType == .cd || drive.isExternal
         let isCd = drive.imageType == .cd && drive.interface != .floppy
@@ -502,7 +512,7 @@ import Virtualization // for getting network interfaces
             } else {
                 "ide-hd"
             }
-            if drive.isIdeInterfaceMultipleUnits {
+            if drive.interfaceVersion >= 1 && !isIdeInterfaceSingleUnit {
                 "bus=ide.\(busindex / 2)"
                 "unit=\(busindex % 2)"
             } else {

+ 0 - 5
Configuration/UTMQemuConfigurationDrive.swift

@@ -53,11 +53,6 @@ struct UTMQemuConfigurationDrive: UTMConfigurationDrive {
     /// If initialized, returns a default interface for an image type. Not saved.
     var defaultInterfaceForImageType: ((QEMUDriveImageType) -> QEMUDriveInterface)?
     
-    /// On older versions of UTM, IDE bus used one unit per bus and this is for compatibility
-    var isIdeInterfaceMultipleUnits: Bool {
-        interfaceVersion >= 1
-    }
-    
     enum CodingKeys: String, CodingKey {
         case imageName = "ImageName"
         case imageType = "ImageType"